/* カスタムアニメーション */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(50px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

@keyframes swipeLeft {
    to {
        transform: translateX(-100%) rotate(-30deg);
        opacity: 0;
    }
}

@keyframes swipeRight {
    to {
        transform: translateX(100%) rotate(30deg);
        opacity: 0;
    }
}

@keyframes shimmer {
    0% {
        background-position: -200px 0;
    }
    100% {
        background-position: calc(200px + 100%) 0;
    }
}

/* スムーススクロール */
html {
    scroll-behavior: smooth;
}

/* ヒーローセクションのアニメーション */
.hero-content > div {
    animation: fadeInUp 1s ease-out;
}

/* カードホバーエフェクト */
.card:hover {
    transform: translateY(-5px);
    transition: transform 0.3s ease;
}

/* マップコンテナ */
#map {
    border-radius: 0.5rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

/* フィルターボタンのアクティブ状態 */
.filter-btn.active {
    background-color: var(--primary);
    color: var(--primary-content);
    border-color: var(--primary);
}

/* 保全状態フィルターボタンのアクティブ状態 */
.conservation-filter-btn.active {
    background-color: var(--neutral);
    color: var(--neutral-content);
    border-color: var(--neutral);
}

.conservation-filter-btn[data-conservation="conserved"].active {
    background-color: var(--success);
    color: var(--success-content);
    border-color: var(--success);
}

.conservation-filter-btn[data-conservation="not-conserved"].active {
    background-color: var(--error);
    color: var(--error-content);
    border-color: var(--error);
}

/* 保全状態マーカーのスタイル */
.conservation-marker-conserved {
    border-color: #10b981 !important;
    background-color: #10b981 !important;
}

.conservation-marker-not-conserved {
    border-color: #ef4444 !important;
    background-color: #ef4444 !important;
}

.conservation-marker-conserved::after {
    content: '🛡️';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 12px;
    background: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.conservation-marker-not-conserved::after {
    content: '⚠️';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 12px;
    background: white;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

/* マッチングカードのスタイル */
.matching-card {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 300px;
    height: 400px;
    border-radius: 1rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    cursor: grab;
    transition: transform 0.3s ease;
    z-index: 1;
}

.matching-card:nth-child(2) {
    z-index: 2;
    transform: translateX(-50%) scale(0.95);
}

.matching-card:nth-child(3) {
    z-index: 3;
    transform: translateX(-50%) scale(0.9);
}

.matching-card.dragging {
    cursor: grabbing;
    z-index: 10;
}

.matching-card.swipe-left {
    animation: swipeLeft 0.3s ease-out forwards;
}

.matching-card.swipe-right {
    animation: swipeRight 0.3s ease-out forwards;
}

.matching-card.swiping-left {
    box-shadow: -10px 0 20px rgba(239, 68, 68, 0.3);
}

.matching-card.swiping-right {
    box-shadow: 10px 0 20px rgba(34, 197, 94, 0.3);
}

/* カードコンテンツ */
.card-content {
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-category {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.card-category.resource {
    background-color: var(--success);
    color: var(--success-content);
}

.card-category.idea {
    background-color: var(--info);
    color: var(--info-content);
}

.card-category.funding {
    background-color: var(--warning);
    color: var(--warning-content);
}

.card-category.talent {
    background-color: var(--error);
    color: var(--error-content);
}

.card-category.cultural {
    background-color: var(--secondary);
    color: var(--secondary-content);
}

.card-category.community {
    background-color: var(--accent);
    color: var(--accent-content);
}

.card-category.research {
    background-color: var(--neutral);
    color: var(--neutral-content);
}

/* 統計カードのアニメーション */
.stat {
    animation: slideInRight 0.8s ease-out;
    animation-fill-mode: both;
}

.stat:nth-child(1) { animation-delay: 0.1s; }
.stat:nth-child(2) { animation-delay: 0.2s; }
.stat:nth-child(3) { animation-delay: 0.3s; }
.stat:nth-child(4) { animation-delay: 0.4s; }
.stat:nth-child(5) { animation-delay: 0.5s; }

/* プログレスバーのアニメーション */
.progress {
    animation: pulse 2s infinite;
}

/* 新規資金調達カードのスタイル */
.funding-card {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.funding-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

/* 神社仏閣関連のスタイル */
.shrine-card {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    color: white;
}

.shrine-marker {
    background: linear-gradient(135deg, #ff9a56 0%, #ff6b6b 100%);
    border: 3px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 里山シェアリング関連のスタイル */
.satoyama-card {
    background: linear-gradient(135deg, #4ade80 0%, #22d3ee 100%);
    color: white;
}

/* 地域課題投稿モーダルのスタイル */
.challenge-form {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
}

.challenge-form .form-control {
    margin-bottom: 1rem;
}

.challenge-form .input,
.challenge-form .select,
.challenge-form .textarea {
    border: 2px solid transparent;
    transition: border-color 0.3s ease;
}

.challenge-form .input:focus,
.challenge-form .select:focus,
.challenge-form .textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(var(--primary), 0.1);
}

/* コミュニティカードの新しいスタイル */
.community-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
    overflow: hidden;
}

.community-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.community-card:hover::before {
    left: 100%;
}

.community-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* マッチング結果のスタイル */
.match-item {
    border-left: 4px solid var(--success);
    transition: transform 0.2s ease;
}

.match-item:hover {
    transform: translateX(5px);
}

/* ローディング状態のスタイル */
.loading-shimmer {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200px 100%;
    animation: shimmer 1.5s infinite;
}

/* レスポンシブ対応 */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2.5rem;
    }
    
    .hero p {
        font-size: 1rem;
    }
    
    .matching-card {
        max-width: 280px;
        height: 350px;
    }
    
    .grid {
        gap: 1rem;
    }
    
    .funding-card {
        margin-bottom: 1rem;
    }
}

@media (max-width: 640px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .matching-card {
        max-width: 260px;
        height: 320px;
    }
    
    .stat {
        padding: 1rem;
    }
    
    .hero .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
    .hero {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
    }
    
    .loading-shimmer {
        background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
        background-size: 200px 100%;
        animation: shimmer 1.5s infinite;
    }
}

/* アクセシビリティ */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* カスタムスクロールバー */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--base-200);
}

::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-focus);
}

/* フォーカス状態の改善 */
.btn:focus,
.card:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ローディングアニメーション */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--base-300);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 新規追加要素のスタイル */
.gradient-text {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* モーダルのアニメーション */
.modal[open] {
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* 特別なボタンスタイル */
.btn-gradient {
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    border: none;
    color: white;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-gradient:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
}

/* 成功メッセージのスタイル */
.success-message {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    animation: slideInRight 0.5s ease-out;
}

/* エラーメッセージのスタイル */
.error-message {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 1rem;
    border-radius: 0.5rem;
    animation: slideInRight 0.5s ease-out;
}