/* --------------------------- */
/* Global Styles */
/* --------------------------- */
html, body {
    margin: 0;
    padding: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    touch-action: pan-x, pan-y;
}

* {transition: all 0.3s ease;}

/* --------------------------- */
/* Development Borders */
/* --------------------------- */
/* Uncomment the following lines to enable borders for debugging layout */
/* html, body {border: 1px solid blue;} */
/* .card > div {border: 1px solid red;} */
/* */

/* --------------------------- */
/* Frosted Blur Backgrounds */
/* --------------------------- */
:root {
    --transparency: 0.7;
}

/* --------------------------- */
/* Card Layout Styles */
/* --------------------------- */
.card:not(.expanded) {margin-top: 40%;border-radius: 15px;}
.card.expanded {margin-top: 0%;}
body:has(.card:not(.expanded)) {padding: 3vw;}
body:has(.card:not(.expanded)) nav {top: 3vw;border-radius: 15px;}

.card.expanded {min-height: calc(100dvh - 50px);}
.card.expanded > .card-header > .grabber {opacity: 0;pointer-events: none;}
.card.expanded > .card-header {padding: 0;height: 0;overflow: hidden;}
body:has(.card.expanded) .background-cover {opacity: calc(1 - var(--transparency));}

/* --------------------------- */
/* Background Cover Style */
/* --------------------------- */
.background-cover {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.background-cover img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: blur(18px) brightness(0.7);
    transform: scale(1.1);
}

/* --------------------------- */
/* Navigation Bar Style */
/* --------------------------- */
nav {
    position: sticky;
    z-index: 10;
    top: 0;

    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(0, 0, 0, 0.1);

    display: flex;
    align-items: right;
    justify-content: flex-end;
    background-color: rgba(255, 255, 255, var(--transparency));

    height: 30px;
    padding: 10px; 
}

nav * {
    height: 100%;
    border-radius: 5px;
}

/* Language Selector */
nav > .lang-select > select {
    border: none;
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0 10px;
    font-size: 1em;
    cursor: pointer;
}

/* --------------------------- */
/* Scrollbar Style */
/* --------------------------- */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.25);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background-color: rgba(0, 0, 0, 0.4);
}

/* --------------------------- */
/* Card Style */
/* --------------------------- */
.card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    
    margin: auto;
    background-color: rgba(255, 255, 255, var(--transparency));
    
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    overflow-x: hidden;
}

/* --------------------------- */
/* Card Content Style */
/* --------------------------- */

/* Card QR Code Style */
.card-qrcode {
    display: block;
    display: none;
    margin-left: auto;
    max-width: 30vw;
    width: 150px;
    background-color: rgba(255, 255, 255, calc(1 - var(--transparency)));
    padding: 15px;
    border-radius: 5px;
    text-align: center;
}
.card-qrcode::after {content: attr(data-text);border: 5px;}
.card-qrcode > img {width: calc(100% - 30px);border: 15px solid white;margin-bottom: 10px;}

/* Card Text Style */
.card h1, .card h2, .card h3, .card h4, .card h5, .card h6 {
    text-align: center;

    font-size: 2.2em;
}
.card p {
    margin-left: 25px;
    margin-right: 25px;

    font-size: 1em;
}
.card.expanded p {
    font-size: 1.5em;
    font-weight: 300;
}

/* Card Div Style */
.card > div {
    border-radius: 5px;
    padding: 0 20px;
}
.card > .card-header {
    padding: 20px;
}
.card > .card-footer {
    padding-bottom: 20px;
}

/* Card Header */
.card-header > .grabber {
    width: 30%;
    min-width: 50px;
    max-width: 100px;
    height: 5px;

    display: block;
    margin: auto;

    cursor: grab;

    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 360px;
}

/* Card Picture Style */
.card-picture {
    display: flex;
    gap: 5px;
}

.card-picture > button {
    background-color: rgba(0, 0, 0, 0.1);
    border: none;
    border-radius: 360px;
    width: 40px;
    height: 40px;
    font-size: 24px;
    cursor: pointer;
    align-self: center;
    color: dodgerblue;
}
.card-picture > button:disabled {
    opacity: 0.3;
    color: gray;
    cursor: default;
}
.card-picture:has(div > img:only-child) > button {display: none;}

.card-picture > div {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    max-width: 100%;
    border-radius: 15px;
    max-height: 60vh;
}

.card-picture > div > img {
    height: auto;
    max-height: 100%;
    width: 100%;
    
    border-radius: 15px;
    object-fit: contain;
}

/* Card Picture Scroll Snap Implementation */
    .card-picture > div {
        scroll-snap-type: x mandatory;
        scroll-behavior: smooth;

        /* hide scrollbar but keep scrolling */
        scrollbar-width: none;          /* Firefox */
        -ms-overflow-style: none;       /* IE/Edge */
    }
    .card-picture > div::-webkit-scrollbar {
        display: none;                  /* Chrome/Safari */
    }
    .card-picture > div > img {
        scroll-snap-align: center;
        flex: 0 0 100%;
    }
/* end */

/* --------------------------- */
/* Page Index Style */
/* --------------------------- */
div#indice-piante table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    border-radius: 12px;
    overflow: hidden;
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

div#indice-piante table thead tr:first-child th {
    background-color: rgba(245, 245, 245, calc(1 - var(--transparency)));
}

div#indice-piante table tbody tr:nth-child(odd) {
    background-color: rgba(255, 255, 255, calc(1 - var(--transparency)));
}

div#indice-piante table tbody tr:nth-child(even) {
    background-color: rgba(248, 248, 248, calc(1 - var(--transparency)));
}

div#indice-piante tbody tr:hover {
    background-color: rgba(230, 230, 230, calc(1 - var(--transparency)));
}

div#indice-piante th,
div#indice-piante td {
    border: none;
    padding: 12px 16px;
    font-size: 1.5rem;
    text-align: center;
}

div#indice-piante table tbody {
    max-height: 70vh;
    overflow-y: auto;
}

div#indice-piante a {
    text-decoration: none;
    font-weight: bold;
    font-size: 1.5rem;
    color: black;
}

div#indice-piante a:hover {
    text-decoration: underline;
    color: rgb(17, 81, 145);
}

/* --------------------------- */
/* Dark Mode Styles */
/* --------------------------- */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    .card {
        background-color: rgba(30, 30, 30, var(--transparency));
        color: #f0f0f0;
    }

    nav {
        background-color: rgba(45, 45, 45, var(--transparency));
        color: #f0f0f0;
    }

    nav > .lang-select > select {
        background-color: rgba(0, 0, 0, 0.1);
        color: white;
    }

    .card-header > .grabber {
        background-color: rgba(255, 255, 255, 0.2);
    }

    .card-qrcode {
        background-color: rgba(0, 0, 0, calc(1 - var(--transparency)));
    }

    div#indice-piante table thead tr:first-child th {
        background-color: rgba(45, 45, 45, calc(1 - var(--transparency)));
    }

    div#indice-piante table tbody tr:nth-child(odd) {
        background-color: rgba(30, 30, 30, calc(1 - var(--transparency)));
    }

    div#indice-piante table tbody tr:nth-child(even) {
        background-color: rgba(35, 35, 35, calc(1 - var(--transparency)));
    }

    div#indice-piante tbody tr:hover {
        background-color: rgba(20, 20, 20, calc(1 - var(--transparency)));
    }

    div#indice-piante a {
        color: white;
    }
}

/* --------------------------- */
/* Other Styles */
/* --------------------------- */
@media(min-width: 1024px) {
    .card-flex-splitter {
        display: flex;
    }
}

@media print {
    :root {
        --transparency: 1;
    }

    nav {display: none;}
    .card-header {display: none;}
    .background-cover {display: none;}
    .card-qrcode {display: block;width: 100%;max-width: unset;padding: 0;}
    .card-qrcode::after {line-height: 1.2;font-size: 3rem;}

    body {padding: 0 !important;}
    .card {margin-top: 0% !important;border-radius: 0 !important;min-height: 100dvh;box-shadow: none;}
    .card h1, .card h2, .card h3, .card h4, .card h5, .card h6 {
        text-align: center;
        font-size: 2.2em;
        font-weight: 800;
    }
    .card p {
        font-size: 1.5em;
        font-weight: 500 !important;
    }
    .card-picture > button {display: none;}


    .card-content {min-height: 100dvh;}
    .card-flex-splitter {display: flex;flex-direction: column;}
    .card-picture {display: block;width: min-content;height: 30dvh;margin: auto;padding: 0 20px;}
    .card-picture > div {display: flex;height: 30dvh;width: min-content;}

    .card-picture > div > img {all: unset; height: 100%;}

}