:root {
    /* New Color Palette - Professional & Fresh */
    --primary-green: #2E7D32;
    --secondary-green: #81C784;
    --accent-orange: #FFA726;
    --background-white: #FAFAFA;
    --card-white: #FFFFFF;
    --text-dark: #212121;
    --text-medium: #616161;
    --text-light: #9E9E9E;
    --border-light: rgba(0, 0, 0, 0.08);

    /* Shadows */
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 8px 32px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.15);
    --shadow-xl: 0 30px 80px rgba(0, 0, 0, 0.2);

    /* Gradients */
    --gradient-header: linear-gradient(135deg, #ffffff 0%, #f0f9f4 100%);
    --gradient-hero: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 50%, #a5d6a7 100%);
    --gradient-card: linear-gradient(135deg, rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.7) 100%);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Noto Sans JP', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--background-white);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scroll Navigation */
.scroll-nav {
    background: var(--gradient-header);
    border-bottom: none;
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-right: 20px;
}

.scroll-container {
    display: flex;
    justify-content: center;
    gap: 0;
    padding: 0;
    max-width: 800px;
    margin: 0 auto;
}

.nav-tab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 20px;
    text-decoration: none;
    color: var(--text-medium);
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 1px solid var(--border-light);
    position: relative;
}

.nav-tab:last-child {
    border-right: none;
}

.nav-tab:hover {
    background: rgba(46, 125, 50, 0.05);
    color: var(--primary-green);
}

.nav-tab.active {
    background: rgba(46, 125, 50, 0.1);
    color: var(--primary-green);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20%;
    right: 20%;
    height: 3px;
    background: var(--primary-green);
    border-radius: 3px 3px 0 0;
    box-shadow: 0 -2px 8px rgba(46, 125, 50, 0.3);
}

.nav-icon {
    font-size: 1.8rem;
}

/* Auth Section */
.auth-section {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-button {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 24px;
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.login-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-name {
    font-weight: 600;
    color: var(--text-dark);
    font-size: 0.9rem;
}

.logout-button {
    background: var(--text-light);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.logout-button:hover {
    background: var(--text-medium);
    transform: translateY(-1px);
}


/* Main Container */
.main-container {
    max-width: 1200px;
    margin: 30px auto;
    padding: 0 20px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.main-container.full-width {
    max-width: 100%;
}

/* Order Filter Grid */
.order-filter-container {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 12px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.order-filter-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: white;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    height: 80px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.order-filter-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.order-filter-btn.active {
    border-color: var(--primary-green);
    background: #F1F8E9;
}

.order-filter-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    margin-bottom: 5px;
}

.order-filter-emoji {
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.order-filter-name {
    font-size: 0.75rem;
    color: var(--text-dark);
    text-align: center;
    font-weight: 500;
}

/* Order Count Badge */
.order-count-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    color: white;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(76, 175, 80, 0.4);
    min-width: 32px;
    text-align: center;
    line-height: 1.2;
    letter-spacing: 0.3px;
}

.order-filter-btn {
    position: relative;
    /* バッジの絶対配置のため */
}


/* Responsive adjustments */
@media (max-width: 900px) {
    .order-filter-container {
        grid-template-columns: repeat(6, 1fr);
    }
}

@media (max-width: 600px) {
    .order-filter-container {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Content Area */
.content-area {
    width: 100%;
}

/* Bird Grid */
.bird-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.bird-card {
    /* 背景色はJSで動的に設定されます */
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    height: 100%;
    overflow: hidden;
    /* 角丸を効かせるため */
}

.bird-card-inner {
    background: transparent;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
    width: 100%;
}

.bird-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-hero);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.bird-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: var(--shadow-lg), 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: var(--secondary-green);
}

.bird-card:hover::before {
    opacity: 1;
}

.modal-bird-image-container img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    border: none;
    object-fit: contain;
    background: transparent;
    transition: all 0.4s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* 軽い影を追加 */
}

.bird-thumbnail {
    width: 120px;
    height: 120px;
    border-radius: 8px;
    border: none;
    object-fit: contain;
    background: transparent;
    transition: all 0.4s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    /* 軽い影を追加 */
}

.bird-card:hover .bird-thumbnail {
    border-color: transparent;
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.bird-name {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-dark);
    text-align: center;
}

.bird-icon {
    width: 24px;
    height: 24px;
}

/* Observation Button */
.observation-button {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--text-light);
    color: var(--text-light);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.observation-button:hover {
    transform: scale(1.1);
    border-color: var(--primary-green);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.observation-button.observed {
    background: linear-gradient(135deg, #4CAF50 0%, #66BB6A 100%);
    border-color: #4CAF50;
    color: white;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.observation-button.observed:hover {
    background: linear-gradient(135deg, #388E3C 0%, #4CAF50 100%);
}

/* Observed Bird Card */
.bird-card.observed {
    border: 2px solid #4CAF50;
    box-shadow: 0 8px 24px rgba(76, 175, 80, 0.2), 0 4px 12px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, rgba(232, 245, 233, 0.9) 0%, rgba(255, 255, 255, 0.9) 100%);
}

.bird-card.observed::before {
    background: linear-gradient(90deg, #4CAF50 0%, #66BB6A 100%);
    opacity: 1;
}

.bird-card.observed .bird-thumbnail {
    border-color: #4CAF50;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}


/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 30px 0;
}

.page-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--wood-frame);
    opacity: 0.4;
    cursor: pointer;
    transition: all 0.3s ease;
}

.page-dot.active {
    opacity: 1;
    background: var(--nature-green);
    transform: scale(1.3);
}

.page-dot:hover {
    opacity: 0.7;
}

/* Responsive */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }

    .filter-sidebar {
        width: 100%;
    }

    .filter-frame {
        position: static;
    }

    .bird-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}

@media (max-width: 640px) {
    .scroll-container {
        gap: 0;
    }

    .nav-tab {
        padding: 12px 8px;
        font-size: 0.75rem;
    }

    .nav-icon {
        font-size: 1.4rem;
    }

    .bird-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }

    .bird-thumbnail {
        width: 100px;
        height: 100px;
    }
}

/* Bird Number Badge */
.bird-number {
    font-family: 'Roboto', sans-serif;
    font-size: 0.85rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

/* Ensure Observation Modal is fixed */
#observation-modal {
    position: fixed !important;
}

.modal-content {
    position: relative;
    background: linear-gradient(135deg, #F5E6D3 0%, #EFEBE9 100%);
    border: 4px solid var(--wood-frame);
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: slideUp 0.4s ease;
    z-index: 1001;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--dark-brown);
    color: white;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-close:hover {
    background: var(--nature-green);
    transform: rotate(90deg);
}

.modal-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--dark-brown);
    color: white;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.modal-nav:hover {
    background: var(--nature-green);
    transform: translateY(-50%) scale(1.1);
}

.modal-nav-prev {
    left: -25px;
}

.modal-nav-next {
    right: -25px;
}

.modal-bird-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
}

.modal-bird-image-container {
    width: 100%;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    background: transparent;
    border-radius: 12px;
    overflow: hidden;
}

.modal-bird-image-container img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
}

.modal-bird-info {
    text-align: left;
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-top: 1rem;
    width: 100%;
}

.modal-bird-name {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    text-align: center;
}

.modal-bird-meta {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    color: var(--text-light);
}

.modal-bird-order,
.modal-bird-family {
    background: var(--accent-orange);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.modal-bird-info p {
    margin-bottom: 0.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.modal-bird-features {
    margin-top: 1rem;
}

.modal-bird-features strong {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--primary-green);
}

.modal-bird-number {
    font-size: 1rem;
    color: var(--wood-frame);
    font-weight: 600;
    margin-bottom: 30px;
}

.modal-stats {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
    border: 2px solid var(--wood-frame);
}

.stat-row {
    display: grid;
    grid-template-columns: 100px 1fr 50px;
    align-items: center;
    gap: 15px;
}

.stat-label {
    font-weight: 600;
    color: var(--dark-brown);
    text-align: left;
    font-size: 0.95rem;
}

.stat-bar-container {
    height: 20px;
    background: rgba(141, 110, 99, 0.2);
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--wood-frame);
}

.stat-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--nature-green) 0%, #7CB342 100%);
    border-radius: 10px;
    transition: width 0.6s ease;
    box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.stat-value {
    font-weight: 700;
    color: var(--dark-brown);
    text-align: right;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Modal Responsive */
@media (max-width: 768px) {
    .modal-content {
        padding: 30px 20px;
        max-width: 95%;
    }

    .modal-bird-image-container {
        width: 200px;
        height: 200px;
    }

    .modal-bird-name {
        font-size: 1.5rem;
    }

    .modal-nav {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }

    .modal-nav-prev {
        left: -15px;
    }

    .modal-nav-next {
        right: -15px;
    }

    .stat-row {
        grid-template-columns: 80px 1fr 40px;
        gap: 10px;
    }

    .stat-label {
        font-size: 0.85rem;
    }
}

/* Bird Order Type Badge Styles */
.order-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.order-badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.order-emoji {
    font-size: 1.2rem;
    line-height: 1;
}

.order-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.order-name {
    font-size: 0.8rem;
    white-space: nowrap;
}

/* Order badge in bird card */
.bird-card .order-badge {
    margin-top: 4px;
    font-size: 0.75rem;
    padding: 3px 10px;
}

.bird-card .order-emoji {
    font-size: 1rem;
}

.bird-card .order-icon {
    width: 24px;
    height: 24px;
}

.bird-card .order-name {
    font-size: 0.7rem;
}

/* Order badge in modal */
.modal-bird-info .order-badge {
    margin-bottom: 15px;
    font-size: 0.9rem;
    padding: 6px 14px;
}

.modal-bird-info .order-emoji {
    font-size: 1.4rem;
}

.modal-bird-info .order-icon {
    width: 40px;
    height: 40px;
}

.modal-bird-info .order-name {
    font-size: 0.85rem;
}