* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f4f0;
    color: #333;
    min-height: 100vh;
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.back-link {
    color: #2e7d32;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1em;
}

h1 {
    font-size: 1.5em;
    color: #1b5e20;
}

.subtitle {
    color: #666;
    margin-bottom: 24px;
    text-align: center;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin: 24px 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 12px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s, transform 0.1s;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: #2e7d32; color: white; }
.btn-secondary { background: #e8f5e9; color: #2e7d32; }
.btn-success { background: #1b5e20; color: white; }

.btn-large {
    width: 100%;
    padding: 16px 24px;
    font-size: 1.15em;
}

.btn-icon { font-size: 1.4em; }

.photo-preview {
    width: 100%;
    aspect-ratio: 4/3;
    background: #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}

.photo-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.placeholder {
    color: #999;
    font-size: 1.1em;
}

.step { display: none; }
.step.active { display: block; }

.info-row {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.95em;
}

.label { color: #666; font-weight: 500; }

.species-result {
    text-align: center;
    margin: 16px 0;
}

.species-name {
    font-size: 1.3em;
    font-weight: 700;
    color: #1b5e20;
    display: block;
    margin-top: 4px;
}

.hidden { display: none !important; }

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e0e0e0;
    border-top-color: #2e7d32;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 16px auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

#loading, #saveLoading {
    text-align: center;
    margin: 16px 0;
}

.stats-card {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin: 16px 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.stats-card p { margin: 4px 0; }

.success-icon {
    font-size: 3em;
    text-align: center;
    margin: 24px 0 8px;
}

#step-saved h2 {
    text-align: center;
    margin-bottom: 4px;
}

#step-saved p {
    text-align: center;
    font-size: 1.2em;
    font-weight: 600;
    color: #1b5e20;
    margin-bottom: 24px;
}

#step-saved .btn {
    margin-bottom: 12px;
}

/* ── Auth Forms ── */

.auth-form {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.9em;
    color: #555;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 1em;
    background: #fafafa;
    transition: border-color 0.2s;
}

.form-group input:focus {
    outline: none;
    border-color: #2e7d32;
    background: white;
}

.form-error {
    color: #d32f2f;
    font-size: 0.9em;
    margin-bottom: 12px;
    min-height: 1.2em;
}

.auth-switch {
    text-align: center;
    margin-top: 16px;
    font-size: 0.9em;
    color: #666;
}

.auth-switch a {
    color: #2e7d32;
    font-weight: 600;
    text-decoration: none;
}

.dashboard-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
}

.user-greeting {
    color: #666;
    font-size: 0.95em;
    margin-top: 2px;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.85em;
}

.dashboard-menu {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.dashboard-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: white;
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: transform 0.15s, box-shadow 0.15s;
}

.dashboard-card:active {
    transform: scale(0.97);
}

.dashboard-card-icon {
    font-size: 2.5em;
}

.dashboard-card-label {
    font-weight: 700;
    font-size: 1.1em;
    color: #1b5e20;
}

.dashboard-card-desc {
    font-size: 0.85em;
    color: #888;
}

@media (min-width: 700px) {
    #app-dashboard.container {
        max-width: 700px;
        padding: 24px 32px;
    }

    .dashboard-header h1 {
        font-size: 1.8em;
    }

    .dashboard-menu {
        flex-direction: row;
    }

    .dashboard-card {
        flex: 1;
        padding: 32px 24px;
    }

    .dashboard-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    }

    .thumbnails img {
        width: 80px;
        height: 80px;
    }
}

@media (min-width: 1100px) {
    #app-dashboard.container {
        max-width: 900px;
        padding: 32px 40px;
    }
}

.stats-encourage {
    margin-top: 4px !important;
    font-size: 0.9em;
    color: #2e7d32;
    font-weight: 600;
}

/* ── Landing Page ── */

.landing-page {
    max-width: 100%;
    padding: 0;
    background: #f0f4f0;
    overflow-x: hidden;
}

.hero {
    text-align: center;
    padding: 48px 24px 40px;
    background: linear-gradient(180deg, #1b5e20 0%, #2e7d32 50%, #388e3c 100%);
    color: white;
    position: relative;
}

.hero::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 40px;
    background: #f0f4f0;
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.hero-emojis {
    font-size: 3em;
    margin-bottom: 12px;
    letter-spacing: 10px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.hero-badge {
    display: inline-block;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.9);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 600;
    margin-bottom: 16px;
    letter-spacing: 0.5px;
}

.hero h1 {
    font-size: 2em;
    margin-bottom: 16px;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.2;
    color: white;
}

.hero-text {
    font-size: 1.1em;
    line-height: 1.6;
    color: rgba(255,255,255,0.85);
    max-width: 600px;
    margin: 0 auto 28px;
}

.hero-cta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.hero-cta .btn-secondary {
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
}

.section {
    padding: 40px 24px;
    max-width: 1100px;
    margin: 0 auto;
}

.section-title {
    text-align: center;
    font-size: 1.5em;
    color: #1b5e20;
    margin-bottom: 28px;
}

/* Steps Grid */

.steps-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.step-card {
    background: white;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    text-align: center;
    position: relative;
}

.step-circle {
    width: 40px;
    height: 40px;
    background: #2e7d32;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1em;
    margin: 0 auto 12px;
}

.step-icon {
    font-size: 2.2em;
    display: block;
    margin-bottom: 12px;
}

.step-card h3 {
    font-size: 1.1em;
    color: #1b5e20;
    margin-bottom: 8px;
}

.step-card p {
    font-size: 0.9em;
    color: #666;
    line-height: 1.5;
    margin: 0;
}

/* Benefits Grid */

.section-green {
    background: #e8f5e9;
}

.benefits-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.benefit-card {
    background: white;
    border-radius: 16px;
    padding: 28px 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    text-align: center;
}

.benefit-icon {
    font-size: 2.5em;
    margin-bottom: 12px;
}

.benefit-card h3 {
    font-size: 1.15em;
    color: #1b5e20;
    margin-bottom: 8px;
}

.benefit-card p {
    font-size: 0.95em;
    color: #555;
    line-height: 1.5;
    margin: 0;
}

/* Fun Fact */

.fun-fact {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    align-items: flex-start;
    gap: 16px;
    font-size: 1em;
    line-height: 1.5;
}

.fun-fact-icon {
    font-size: 2em;
    flex-shrink: 0;
}

.fun-fact strong {
    color: #1b5e20;
    display: block;
    margin-bottom: 4px;
}

/* Quote */

.section-quote {
    padding-top: 0;
    padding-bottom: 0;
}

.quote {
    font-size: 1.15em;
    line-height: 1.6;
    color: #555;
    font-style: italic;
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 0;
    border: none;
}

.quote cite {
    display: block;
    margin-top: 8px;
    font-size: 0.85em;
    color: #999;
    font-style: normal;
}

/* CTA Section */

.cta-section {
    text-align: center;
}

.cta-text {
    color: #555;
    font-size: 1.05em;
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.cta-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

/* Footer */

.landing-footer {
    text-align: center;
    padding: 24px;
    color: #aaa;
    font-size: 0.85em;
}

@media (min-width: 700px) {
    .hero {
        padding: 72px 32px 56px;
    }

    .hero-emojis {
        font-size: 3.5em;
        letter-spacing: 14px;
    }

    .hero h1 {
        font-size: 2.8em;
    }

    .hero-text {
        font-size: 1.2em;
    }

    .hero-cta {
        flex-direction: row;
        max-width: 520px;
    }

    .hero-cta .btn-large {
        width: auto;
        padding: 14px 28px;
    }

    .section {
        padding: 56px 32px;
    }

    .section-title {
        font-size: 1.8em;
        margin-bottom: 36px;
    }

    .steps-grid {
        flex-direction: row;
        gap: 24px;
    }

    .step-card {
        flex: 1;
        padding: 32px 24px;
    }

    .benefits-grid {
        flex-direction: row;
        gap: 24px;
    }

    .benefit-card {
        flex: 1;
        padding: 36px 28px;
    }

    .cta-buttons {
        flex-direction: row;
        max-width: 520px;
    }

    .cta-buttons .btn-large {
        width: auto;
        padding: 14px 28px;
    }
}

@media (min-width: 1100px) {
    .hero {
        padding: 96px 32px 64px;
    }

    .hero h1 {
        font-size: 3.2em;
    }

    .section {
        padding: 72px 32px;
    }
}

.recent-sightings {
    margin-top: 20px;
}

.recent-sightings h2 {
    font-size: 1.1em;
    color: #1b5e20;
    margin-bottom: 12px;
}

.thumbnails {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
}

.thumbnails img {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #e0e0e0;
    flex-shrink: 0;
}

/* ── Responsive Map Page ── */

.map-page {
    max-width: 100%;
    padding: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.map-page header {
    padding: 12px 16px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.map-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.map-section {
    flex: 1;
    min-height: 0;
    position: relative;
}

.map-section #map {
    height: 100%;
    width: 100%;
    border-radius: 0;
}

.sidebar-section {
    flex-shrink: 0;
    max-height: 40vh;
    overflow-y: auto;
    padding: 12px 16px 16px;
    background: #f0f4f0;
}

.sidebar-section .stats-card {
    margin: 0 0 12px;
}

.sidebar-section h2 {
    font-size: 1.15em;
    margin-bottom: 8px;
    color: #1b5e20;
}

.species-list {
    max-height: none;
    overflow-y: visible;
}

.species-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-bottom: 1px solid #e0e0e0;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.species-item:hover {
    background: #e8f5e9;
}

.species-item img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #2e7d32;
    flex-shrink: 0;
}

.species-item .name {
    font-weight: 600;
    flex: 1;
    font-size: 0.95em;
}

.species-item .count {
    color: #666;
    font-size: 0.85em;
    white-space: nowrap;
}

@media (min-width: 900px) {
    .map-page {
        max-width: 100%;
    }

    .map-page header {
        padding: 16px 24px;
    }

    .map-layout {
        flex-direction: row;
    }

    .map-section {
        flex: 3;
    }

    .sidebar-section {
        flex: 0 0 360px;
        max-height: none;
        overflow-y: auto;
        padding: 20px 20px 20px 16px;
    }

    .sidebar-section .stats-card {
        margin: 0 0 16px;
    }

    .sidebar-section h2 {
        font-size: 1.1em;
        margin-bottom: 12px;
    }

    .species-item {
        padding: 10px 12px;
    }

    .species-item img {
        width: 48px;
        height: 48px;
    }

    .leaflet-popup-content img {
        max-height: 250px;
    }
}

@media (min-width: 1400px) {
    .sidebar-section {
        flex: 0 0 400px;
        padding: 24px 24px 24px 20px;
    }
}

/* ── Species Collection Grid ── */

.collection-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.collection-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    background: white;
    border-radius: 16px;
    padding: 16px 12px;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: pointer;
    border: none;
    width: 100%;
    text-align: center;
}

.collection-card:active {
    transform: scale(0.97);
}

.collection-card img {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #e0e0e0;
}

.collection-card-name {
    font-weight: 700;
    font-size: 1em;
    color: #1b5e20;
}

.collection-card-latin {
    font-style: italic;
    font-size: 0.8em;
    color: #888;
}

.collection-card-badge {
    display: inline-block;
    font-size: 0.75em;
    padding: 2px 10px;
    border-radius: 10px;
    font-weight: 600;
}

.badge-plant {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-animal {
    background: #fff3e0;
    color: #e65100;
}

.collection-card-count {
    font-size: 0.8em;
    color: #999;
}

@media (min-width: 600px) {
    .collection-grid {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 16px;
    }

    .collection-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0,0,0,0.1);
    }

    .collection-card img {
        width: 100px;
        height: 100px;
    }
}

@media (min-width: 900px) {
    .collection-grid {
        grid-template-columns: 1fr 1fr 1fr 1fr;
    }
}

/* ── Sighting Detail List ── */

.sighting-item {
    display: flex;
    gap: 12px;
    align-items: center;
    background: white;
    border-radius: 12px;
    padding: 12px;
    margin-bottom: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.sighting-item img {
    width: 60px;
    height: 60px;
    border-radius: 10px;
    object-fit: cover;
    flex-shrink: 0;
    border: 1px solid #e0e0e0;
}

.sighting-item-info {
    flex: 1;
    min-width: 0;
}

.sighting-item-info .name {
    font-weight: 700;
    font-size: 1em;
    color: #1b5e20;
}

.sighting-item-info .detail {
    font-size: 0.8em;
    color: #888;
    margin-top: 2px;
}

.sighting-item .btn-delete {
    background: none;
    border: none;
    font-size: 1.3em;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.15s;
    flex-shrink: 0;
}

.sighting-item .btn-delete:hover {
    background: #ffebee;
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #888;
}

.empty-state .empty-icon {
    font-size: 3em;
    margin-bottom: 12px;
}
