/* ========================================
   GLOBAL STYLES
======================================== */

:root {

    --bg-color: #f4f8f1;

    --surface-color: #ffffff;

    --text-color: #1d2a20;

    --muted-color: #66736a;

    --primary-color: #2f6b3f;

    --primary-dark: #235230;

    --border-color: #dce7dd;

    --shadow:
        0 15px 40px rgba(31, 61, 38, 0.10);
}


* {

    margin: 0;

    padding: 0;

    box-sizing: border-box;
}


html {

    scroll-behavior: smooth;
}


body {

    font-family:
        Arial,
        Helvetica,
        sans-serif;

    background:
        var(--bg-color);

    color:
        var(--text-color);

    line-height: 1.6;

    overflow-x: hidden;
}


button,
input {

    font: inherit;
}


button {

    cursor: pointer;
}


img {

    max-width: 100%;

    display: block;
}


/* ========================================
   HEADER
======================================== */

.site-header {

    position: sticky;

    top: 0;

    z-index: 1000;

    background:
        rgba(255, 255, 255, 0.92);

    border-bottom:
        1px solid var(--border-color);

    backdrop-filter:
        blur(10px);
}


.navbar {

    width:
        min(1100px, 92%);

    margin:
        0 auto;

    min-height:
        70px;

    display:
        flex;

    align-items:
        center;

    justify-content:
        space-between;
}


.logo {

    color:
        var(--primary-color);

    text-decoration:
        none;

    font-size:
        1.2rem;

    font-weight:
        700;
}


.theme-toggle {

    width:
        42px;

    height:
        42px;

    border:
        1px solid var(--border-color);

    border-radius:
        50%;

    background:
        var(--surface-color);

    color:
        var(--text-color);
}


/* ========================================
   HERO
======================================== */

.hero {

    min-height:
        650px;

    display:
        grid;

    place-items:
        center;

    text-align:
        center;

    padding:
        80px 20px;

    background:
        linear-gradient(
            rgba(244, 248, 241, 0.88),
            rgba(244, 248, 241, 0.88)
        );
}


.hero-content {

    max-width:
        760px;
}


.eyebrow {

    color:
        var(--primary-color);

    font-size:
        0.85rem;

    font-weight:
        700;

    letter-spacing:
        0.12em;

    text-transform:
        uppercase;

    margin-bottom:
        12px;
}


.hero h1 {

    font-size:
        clamp(2.7rem, 7vw, 5rem);

    line-height:
        1.05;

    margin-bottom:
        24px;
}


.hero-text {

    max-width:
        620px;

    margin:
        0 auto 32px;

    color:
        var(--muted-color);

    font-size:
        1.1rem;
}


/* ========================================
   BUTTONS
======================================== */

.primary-button,
.identify-button {

    display:
        inline-block;

    border:
        none;

    border-radius:
        12px;

    padding:
        14px 24px;

    background:
        var(--primary-color);

    color:
        #ffffff;

    text-decoration:
        none;

    font-weight:
        700;

    transition:
        transform 0.2s ease,
        background 0.2s ease;
}


.primary-button:hover,
.identify-button:hover:not(:disabled) {

    background:
        var(--primary-dark);

    transform:
        translateY(-2px);
}


.identify-button {

    width:
        100%;

    margin-top:
        24px;
}


.identify-button:disabled {

    opacity:
        0.5;

    cursor:
        not-allowed;

    transform:
        none;
}


/* ========================================
   SECTIONS
======================================== */

.identifier-section,
.result-section {

    width:
        min(1000px, 92%);

    margin:
        0 auto;

    padding:
        90px 0;
}


.section-heading {

    text-align:
        center;

    max-width:
        700px;

    margin:
        0 auto 40px;
}


.section-heading h2 {

    font-size:
        clamp(2rem, 5vw, 3rem);

    margin-bottom:
        12px;
}


.section-heading > p:last-child {

    color:
        var(--muted-color);
}


/* ========================================
   UPLOAD CARD
======================================== */

.upload-card {

    max-width:
        700px;

    margin:
        0 auto;

    padding:
        30px;

    background:
        var(--surface-color);

    border:
        1px solid var(--border-color);

    border-radius:
        24px;

    box-shadow:
        var(--shadow);
}


.upload-area {

    min-height:
        300px;

    border:
        2px dashed var(--border-color);

    border-radius:
        18px;

    display:
        flex;

    flex-direction:
        column;

    align-items:
        center;

    justify-content:
        center;

    padding:
        40px 20px;

    text-align:
        center;

    cursor:
        pointer;

    transition:
        border-color 0.2s ease,
        background 0.2s ease;
}


.upload-area:hover,
.upload-area.drag-over {

    border-color:
        var(--primary-color);

    background:
        #f0f7f0;
}


.upload-icon {

    font-size:
        3rem;

    margin-bottom:
        16px;
}


.upload-title {

    font-size:
        1.25rem;

    font-weight:
        700;

    margin-bottom:
        8px;
}


.upload-description,
.upload-format {

    color:
        var(--muted-color);
}


.upload-format {

    margin-top:
        8px;

    font-size:
        0.85rem;
}


/* ========================================
   IMAGE PREVIEW
======================================== */

.image-preview {

    margin-top:
        24px;

    text-align:
        center;
}


.image-preview img {

    width:
        min(100%, 420px);

    max-height:
        420px;

    object-fit:
        cover;

    margin:
        0 auto 16px;

    border-radius:
        16px;
}


#removeImage {

    border:
        none;

    background:
        transparent;

    color:
        #b33a3a;

    font-weight:
        700;
}


/* ========================================
   LOADING
======================================== */

#loadingMessage {

    margin-top:
        18px;

    text-align:
        center;

    color:
        var(--primary-color);

    font-weight:
        700;

    animation:
        pulse 1.4s ease-in-out infinite;
}


@keyframes pulse {

    0%,
    100% {
        opacity: 0.45;
    }

    50% {
        opacity: 1;
    }
}


/* ========================================
   RESULT CARD
======================================== */

.plant-result-card {

    display:
        grid;

    grid-template-columns:
        minmax(280px, 0.9fr)
        minmax(320px, 1.1fr);

    gap:
        40px;

    padding:
        28px;

    margin-top:
        30px;

    background:
        var(--surface-color);

    border:
        1px solid var(--border-color);

    border-radius:
        28px;

    box-shadow:
        0 20px 50px rgba(0, 0, 0, 0.08);

    overflow:
        hidden;

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}


.plant-result-card:hover {

    transform:
        translateY(-4px);

    box-shadow:
        0 25px 60px rgba(0, 0, 0, 0.10);
}


/* ========================================
   RESULT IMAGE
======================================== */

.result-image {

    min-height:
        420px;

    border-radius:
        22px;

    overflow:
        hidden;
}


.result-image img {

    width:
        100%;

    height:
        100%;

    min-height:
        420px;

    object-fit:
        cover;

    display:
        block;
}


/* ========================================
   RESULT CONTENT
======================================== */

.result-content {

    min-width:
        0;

    width:
        100%;

    padding:
        32px;

    display:
        flex;

    flex-direction:
        column;

    justify-content:
        center;
}


.result-label {

    color:
        #4f8f5b;

    font-weight:
        700;

    letter-spacing:
        0.04em;

    margin-bottom:
        10px;

    text-transform:
        uppercase;

    font-size:
        0.8rem;
}


#plantName {

    margin:
        0 0 8px;

    font-size:
        clamp(2rem, 4vw, 3rem);

    line-height:
        1.1;

    overflow-wrap:
        anywhere;
}


#scientificName,
.scientific-name {

    color:
        var(--muted-color);

    font-style:
        italic;

    margin-bottom:
        24px;

    overflow-wrap:
        anywhere;

    word-break:
        normal;
}


/* ========================================
   RESULT STATS
======================================== */

.result-stats {

    display:
        grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap:
        16px;

    margin-bottom:
        24px;
}


.stat-card {

    min-width:
        0;

    padding:
        18px;

    border-radius:
        18px;

    background:
        rgba(79, 143, 91, 0.08);

    border:
        1px solid rgba(79, 143, 91, 0.15);

    display:
        flex;

    flex-direction:
        column;

    gap:
        5px;

    overflow:
        hidden;
}


.stat-icon {

    font-size:
        1.5rem;
}


.stat-label {

    font-size:
        0.85rem;

    opacity:
        0.7;
}


.stat-card strong {

    font-size:
        1.15rem;

    overflow-wrap:
        anywhere;
}


/* ========================================
   PLANT INFORMATION
======================================== */

.plant-information {

    width:
        100%;

    min-width:
        0;

    padding:
        24px;

    border-radius:
        20px;

    background:
        rgba(79, 143, 91, 0.06);

    border:
        1px solid rgba(79, 143, 91, 0.12);

    overflow:
        hidden;
}


.plant-information h3 {

    margin:
        0 0 18px;

    font-size:
        1.15rem;
}


.plant-info-content {

    width:
        100%;

    min-width:
        0;

    line-height:
        1.8;
}


/* ========================================
   INFORMATION ROWS
======================================== */

.info-row {

    display:
        grid;

    grid-template-columns:
        minmax(150px, 180px)
        30px
        minmax(0, 1fr);

    align-items:
        center;

    gap:
        10px;

    width:
        100%;

    min-width:
        0;

    padding:
        14px 0;

    border-bottom:
        1px solid rgba(79, 143, 91, 0.12);
}


.info-row:last-child {

    border-bottom:
        none;
}


.info-row > span:first-child {

    min-width:
        0;

    font-weight:
        600;

    white-space:
        normal;

    overflow-wrap:
        anywhere;
}


.info-arrow {

    text-align:
        center;

    font-size:
        1rem;

    opacity:
        0.6;
}


.info-row strong {

    min-width:
        0;

    max-width:
        100%;

    text-align:
        left;

    font-weight:
        700;

    white-space:
        normal;

    overflow-wrap:
        anywhere;

    word-break:
        normal;
}


/* ========================================
   PLANT DETAILS
======================================== */

.plant-details {

    width:
        100%;

    margin-top:
        30px;

    padding:
        28px;

    border-radius:
        24px;

    background:
        linear-gradient(
            135deg,
            rgba(79, 143, 91, 0.12),
            rgba(79, 143, 91, 0.04)
        );

    border:
        1px solid rgba(79, 143, 91, 0.20);

    overflow:
        hidden;
}


.plant-details h3 {

    margin:
        0 0 22px;

    font-size:
        1.4rem;
}


.details-grid {

    display:
        grid;

    grid-template-columns:
        repeat(2, minmax(0, 1fr));

    gap:
        18px;
}


.detail-card {

    position:
        relative;

    min-width:
        0;

    min-height:
        125px;

    padding:
        22px;

    display:
        flex;

    flex-direction:
        column;

    justify-content:
        center;

    gap:
        7px;

    background:
        #ffffff;

    border:
        1px solid rgba(79, 143, 91, 0.15);

    border-radius:
        18px;

    box-shadow:
        0 8px 24px rgba(0, 0, 0, 0.06);

    transition:
        transform 0.25s ease,
        box-shadow 0.25s ease;

    overflow:
        hidden;
}


.detail-card:hover {

    transform:
        translateY(-5px);

    box-shadow:
        0 14px 30px rgba(0, 0, 0, 0.10);
}


.detail-icon {

    font-size:
        1.7rem;
}


.detail-label {

    font-size:
        0.82rem;

    font-weight:
        600;

    text-transform:
        uppercase;

    letter-spacing:
        0.05em;

    opacity:
        0.6;
}


.detail-card strong {

    font-size:
        1.15rem;

    font-weight:
        700;

    overflow-wrap:
        anywhere;

    word-break:
        normal;
}


/* ========================================
   ACTION BUTTONS
======================================== */

.another-plant-action {

    display:
        flex;

    justify-content:
        center;

    margin-top:
        30px;

    width:
        100%;
}


.another-plant-button {

    display:
        inline-flex;

    align-items:
        center;

    justify-content:
        center;

    padding:
        14px 24px;

    min-height:
        48px;

    min-width:
        220px;

    border:
        none;

    border-radius:
        12px;

    font-size:
        1rem;

    font-weight:
        600;

    background:
        #4f8f5b;

    color:
        white;

    transition:
        transform 0.2s ease,
        opacity 0.2s ease;
}


.another-plant-button:hover {

    transform:
        translateY(-2px);

    opacity:
        0.9;
}


/* ========================================
   DOWNLOAD BUTTON
======================================== */

.download-result-action {

    display:
        flex;

    justify-content:
        center;

    width:
        100%;

    margin-top:
        14px;
}


.download-result-button {

    display:
        inline-flex;

    align-items:
        center;

    justify-content:
        center;

    gap:
        9px;

    min-width:
        220px;

    min-height:
        50px;

    padding:
        14px 26px;

    border:
        1px solid rgba(79, 143, 91, 0.25);

    border-radius:
        14px;

    background:
        linear-gradient(
            135deg,
            #ffffff,
            #f1f8f3
        );

    color:
        #356b40;

    font-size:
        1rem;

    font-weight:
        700;

    cursor:
        pointer;

    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.08);

    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease,
        background 0.2s ease;
}


.download-result-button:hover {

    transform:
        translateY(-3px);

    background:
        linear-gradient(
            135deg,
            #f1f8f3,
            #e4f2e7
        );

    box-shadow:
        0 12px 26px rgba(0, 0, 0, 0.12);
}


.download-result-button:active {

    transform:
        translateY(0);
}


.download-result-button:focus-visible {

    outline:
        3px solid rgba(79, 143, 91, 0.25);

    outline-offset:
        3px;
}


/* ========================================
   FOOTER
======================================== */

.site-footer {

    padding:
        30px 20px;

    text-align:
        center;

    color:
        var(--muted-color);

    border-top:
        1px solid var(--border-color);
}


/* ========================================
   DARK MODE
======================================== */

body.dark-mode {

    --bg-color:
        #101812;

    --surface-color:
        #18231b;

    --text-color:
        #e8f1e9;

    --muted-color:
        #aebcaf;

    --primary-color:
        #7fc98d;

    --primary-dark:
        #5fae6d;

    --border-color:
        #2d3c30;

    --shadow:
        0 15px 40px rgba(0, 0, 0, 0.25);
}


body.dark-mode .site-header {

    background:
        rgba(16, 24, 18, 0.92);
}


body.dark-mode .hero {

    background:
        linear-gradient(
            rgba(16, 24, 18, 0.88),
            rgba(16, 24, 18, 0.88)
        );
}


body.dark-mode .upload-area:hover,
body.dark-mode .upload-area.drag-over {

    background:
        #1d2b20;
}


.dark-mode .detail-card {

    background:
        rgba(255, 255, 255, 0.05);

    border-color:
        rgba(255, 255, 255, 0.10);
}


.dark-mode .plant-details {

    background:
        linear-gradient(
            135deg,
            rgba(79, 143, 91, 0.16),
            rgba(79, 143, 91, 0.05)
        );
}


.dark-mode .download-result-button {

    background:
        linear-gradient(
            135deg,
            rgba(255, 255, 255, 0.08),
            rgba(79, 143, 91, 0.12)
        );

    color:
        #b9e2c1;

    border-color:
        rgba(255, 255, 255, 0.12);
}


/* ========================================
   TABLET
======================================== */

@media (max-width: 900px) {

    .plant-result-card {

        grid-template-columns:
            1fr;

        gap:
            24px;
    }


    .result-image {

        min-height:
            350px;
    }


    .result-image img {

        min-height:
            350px;

        max-height:
            500px;
    }
}


/* ========================================
   MOBILE
======================================== */

@media (max-width: 700px) {

    .hero {

        min-height:
            560px;

        padding:
            60px 20px;
    }


    .identifier-section,
    .result-section {

        width:
            94%;

        padding:
            65px 0;
    }


    .upload-card {

        padding:
            18px;
    }


    .upload-area {

        min-height:
            260px;

        padding:
            30px 16px;
    }


    .plant-result-card {

        width:
            100%;

        max-width:
            100%;

        padding:
            18px;

        gap:
            24px;

        border-radius:
            22px;

        overflow:
            hidden;
    }


    .result-image {

        width:
            100%;

        min-height:
            260px;

        max-height:
            400px;

        border-radius:
            18px;
    }


    .result-image img {

        width:
            100%;

        height:
            auto;

        min-height:
            260px;

        max-height:
            400px;

        object-fit:
            cover;
    }


    .result-content {

        width:
            100%;

        max-width:
            100%;

        min-width:
            0;

        padding:
            4px;
    }


    #plantName {

        font-size:
            1.7rem;

        line-height:
            1.25;
    }


    .scientific-name,
    #scientificName {

        font-size:
            0.95rem;

        line-height:
            1.5;
    }


    .result-stats {

        grid-template-columns:
            1fr 1fr;

        gap:
            10px;

        width:
            100%;
    }


    .stat-card {

        min-width:
            0;

        width:
            100%;

        padding:
            14px;
    }


    .stat-card strong {

        display:
            block;

        max-width:
            100%;

        overflow-wrap:
            anywhere;
    }


    .plant-information {

        width:
            100%;

        padding:
            18px;
    }


    /* Important mobile information layout */

    .info-row {

        display:
            grid !important;

        grid-template-columns:
            minmax(0, 1fr)
            22px
            minmax(0, 1fr) !important;

        align-items:
            center !important;

        gap:
            8px !important;

        width:
            100% !important;

        min-width:
            0 !important;
    }


    .info-row span:first-child {

        min-width:
            0 !important;

        width:
            auto !important;

        max-width:
            100% !important;

        white-space:
            normal !important;

        overflow-wrap:
            anywhere !important;
    }


    .info-row .info-arrow {

        width:
            auto !important;

        text-align:
            center !important;
    }


    .info-row strong {

        grid-column:
            3 !important;

        min-width:
            0 !important;

        width:
            auto !important;

        max-width:
            100% !important;

        text-align:
            left !important;

        white-space:
            normal !important;

        overflow-wrap:
            anywhere !important;
    }


    .plant-details {

        width:
            100%;

        padding:
            20px;
    }


    .details-grid {

        grid-template-columns:
            1fr;
    }


    .detail-card {

        min-height:
            105px;

        padding:
            18px;
    }


    .another-plant-action,
    .download-result-action {

        width:
            100%;
    }


    .another-plant-button,
    .download-result-button {

        width:
            100%;

        min-width:
            0;
    }
}


/* ========================================
   VERY SMALL MOBILE
======================================== */

@media (max-width: 420px) {

    .result-stats {

        grid-template-columns:
            1fr;
    }


    .info-row {

        grid-template-columns:
            minmax(0, 1fr)
            18px
            minmax(0, 1fr) !important;

        gap:
            5px !important;
    }


    .plant-information {

        padding:
            14px;
    }


    .plant-details {

        padding:
            16px;
    }
}