:root{
    /* fonts */
    --ibm: "IBM Plex Serif", serif;
    --sans: "DM Sans", sans-serif;

    /* colors */
    --white: #F6F6F6;
    --white-light: #f6f6f62e;
    --black: #0E0E0E;
    --yellow: #FAFB97;
    --glass: #0000009a;
}

body {
    background-color: var(--black);
    margin: 0rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* text */

span {
    font-family: var(--ibm);
    text-wrap: balance;
    display: flex; align-items: center; gap: .5rem;
}

.lucide {
    width: 12px;
    height: 12px;
}

.text-xl {
    font-size: 40px;
    color: var(--white);
}
.text-l {
    font-size: 32px;
    color: var(--white);
}
.text-m {
    font-size: 22px;
    color: var(--white);
    font-weight: 400;
}
.text-s {
    font-size: 13px;
    color: var(--white);
    font-family: var(--sans);
    font-weight: 200;
}
.text-xs {
    font-size: 11px;
    color: var(--white);
    font-family: var(--sans);
    font-weight: 200;
}

.text-button {
    padding: 0px 16px;
    border-radius: 4px;
    color: var(--white);
    background-color: var(--white-light);
    font-size: 13px;
    width: fit-content;
    height: 35px;
    min-width: 35px;
    border: none;
    box-sizing: border-box;
    border-radius: 4px;
    display: grid;
    place-content: center;
}
.text-button.active {
    padding: 0px 16px;
    border-radius: 4px;
    color: var(--black);
    font-size: 13px;
    background-color: var(--yellow);
}

.primary-button {
    width: fit-content;
    height: 35px;
    min-width: 35px;
    border: none;
    box-sizing: border-box;
    border-radius: 20%;
    background-color: var(--white-light);
    display: grid;
    place-content: center;
}

.primary-button .lucide {
    color: var(--white);
    width: 20px;
    height: 20px;
}

.active {
    background-color: var(--yellow);
}

.active .lucide {
    color: var(--black);
}

.tag {
    background-color: var(--yellow);
    color: var(--black);
    font-weight: 500;
    padding: 1px 4px;
    border-radius: 2px;
    width: fit-content;
}

.disabled {
    opacity: .5;
}
.slightly-disabled {
    opacity: .8;
}

.italic {
    font-style: italic;
    font-weight: 200;
}

.normalized {
    font-family: var(--sans);
    font-weight: 300;
}
.lucide.big {
    width: 16px; 
    height: 16px;
}

/* nav */

.nav {
    width: 100%;
    height: fit-content;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.nav.fixed {
    position: fixed;
    z-index: 999;
    padding: 20px 20px;
    box-sizing: border-box;
    background-color: var(--glass);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    box-shadow: 0 8px 32px 0 rgba(0,0,0,0.16);
}

#welcome {
    text-align: end;
}

.pp {
    min-width: 40px;
    min-height: 40px;
    background-color: var(--white-light);
    border-radius: 50%;
    background-image: url("/src/img/snail.avif");
    background-position: center;
    background-size: cover;
}

/* component */

.main-container {
    display: flex;
    flex-direction: column;
    padding: 30px;
    gap: 4rem;
}
.main-container.no-space {
    padding: 0;
}

.group-horizontal {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.group-vertical {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 1rem;
}

.space-between-horizontal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: .8rem;
}

.plants-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    height: 100%;
}

#plants-list  {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.plant-container {
    position: relative;
    min-height: 350px;
    border-radius: 6px;
    outline: 1px solid var(--white-light);
    display: flex;
    flex-direction: column;
    padding: 2rem 1rem;
    box-sizing: border-box;
    justify-content: space-between;
    background-image: 
        linear-gradient(to top, var(--black) 0%, rgba(0,0,0,0) 90%),
        url("/src/img/plant1.jpeg");
    background-position: center;
    background-size: 101%;
}
.plant-container.no-space {
    padding-top: 4rem;
    min-height: 550px;
    border-radius: 0;
    outline: none;
    justify-content: end;
    padding-inline: 2.5rem;
}

.plant-info {
    display: flex;
    flex-direction: column;
    gap: .5rem;
}
.plant-container.no-space .plant-info {
    gap: 1rem;
}

.plant-detail-info-block {
    border-top: 1px solid var(--white-light);
    display: flex;
    flex-direction: column;
    margin-inline: 2.5rem;
    margin-top: 2rem;
    padding-block: 2rem;
    gap: 1rem;
}

/* Plant container come link */
a.plant-container {
    cursor: pointer;
}

/* Blocco scroll pagina quando una modal è aperta */
body.modal-open {
    overflow: hidden;
    touch-action: none;
    position: fixed;
    width: 100%;
    left: 0;
}

html.modal-open {
    overflow: hidden;
}

/* Modal overlay: blocca scroll body; lo scroll avviene dentro .modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--black);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    box-sizing: border-box;
    overflow: hidden;
}

.modal-overlay .modal {
    margin: auto;
    flex-shrink: 1;
    min-height: 0;
}

.modal {
    background: var(--black);
    border-radius: 8px;
    padding: 2rem;
    padding-inline: 30px;
    width: 100%;
    max-width: 420px;
    max-height: min(85vh, 600px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-sizing: border-box;
}

.modal-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
    justify-content: flex-end;
}

.modal input, .modal textarea {
    width: 100%;
    padding: 10px 12px;
    margin-top: 4px;
    background: var(--white-light);
    border: 1px solid var(--white-light);
    border-radius: 4px;
    color: var(--white);
    font-family: var(--sans);
    font-size: 16px;
    box-sizing: border-box;
}

.modal input::placeholder, .modal textarea::placeholder {
    color: var(--white);
    opacity: 0.5;
}

.modal label {
    display: block;
    margin-top: 1rem;
    font-family: var(--sans);
    font-size: 13px;
    color: var(--white);
    opacity: 0.9;
}

.modal label:first-child { margin-top: 0; }

#scan-modal-header {
    padding: 30px;
    box-sizing: border-box;
}

/* Galleria foto */
.photo-gallery {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.photo-gallery img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--white-light);
}

.photo-gallery-thumb {
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 6px;
    overflow: hidden;
    display: block;
}

.photo-gallery-thumb img {
    display: block;
    width: 80px;
    height: 80px;
    object-fit: cover;
    border: 1px solid var(--white-light);
}

.photo-gallery-thumb:hover img {
    opacity: 0.9;
}

/* Lightbox foto: niente scroll interno, solo chiusura */
#photo-lightbox {
    cursor: pointer;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#photo-lightbox-img {
    max-width: 95vw;
    max-height: 95vh;
    object-fit: contain;
    border-radius: 8px;
    pointer-events: none;
}

.photo-lightbox-close {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: var(--glass);
    color: var(--white);
    cursor: pointer;
    display: grid;
    place-content: center;
    z-index: 1001;
}

.photo-lightbox-close .lucide {
    width: 24px;
    height: 24px;
}

/* Classe sintomatologica - tag selezionabili */
.symptom-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.symptom-tag {
    font-family: var(--sans);
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 4px;
    border: 1px solid var(--white-light);
    background: transparent;
    color: var(--white);
    cursor: pointer;
    opacity: 0.6;
    transition: all ease-in-out .1s;
}

.symptom-tag:hover {
    opacity: 0.9;
}

.symptom-tag.selected {
    background: var(--yellow);
    color: var(--black);
    border-color: var(--yellow);
    opacity: 1;
}

/* Scan modal: fullscreen, blocca scroll */
.scan-modal {
    position: fixed;
    inset: 0;
    background: var(--black);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    touch-action: pan-x pan-y;
}

.scan-modal .scan-content {
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-height: 0;
}

.scan-modal .scan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    flex-shrink: 0;
}

.scan-modal .scan-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    min-height: 0;
}

.scan-camera-wrapper {
    width: 100%;
    max-width: 400px;
    aspect-ratio: 3/4;
    border-radius: 8px;
    overflow: hidden;
    background: var(--white-light);
    position: relative;
    border: 1px solid var(--white-light);
}

.scan-camera-wrapper video,
.scan-camera-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.scan-camera-wrapper .camera-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    color: var(--white);
    opacity: 0.7;
    font-family: var(--sans);
    font-size: 14px;
    text-align: center;
}

.scan-camera-wrapper .camera-placeholder .lucide {
    width: 48px;
    height: 48px;
}

.scan-spinner {
    animation: spin 1s linear infinite;
}

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

.scan-actions {
    display: flex;
    gap: 2rem;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.scan-action-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.scan-btn-label {
    font-family: var(--sans);
    font-size: 12px;
    color: var(--white);
    opacity: 0.9;
}

.scan-capture-btn {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    border: 4px solid var(--white);
    background: transparent;
    cursor: pointer;
    display: grid;
    place-content: center;
    transition: background 0.2s, transform 0.1s;
}

.scan-capture-btn:hover {
    background: var(--white-light);
}

.scan-capture-btn:active {
    transform: scale(0.95);
}

.scan-capture-btn .lucide {
    width: 32px;
    height: 32px;
    color: var(--white);
}

.scan-capture-btn.active {
    background: var(--yellow);
    border-color: var(--yellow);
}

.scan-capture-btn.active .lucide {
    color: var(--black);
}

.scan-step-label {
    font-family: var(--sans);
    font-size: 13px;
    color: var(--white);
    opacity: 0.7;
    margin-bottom: 1rem;
}

.scan-form-step .modal {
    max-width: 420px;
    margin: auto;
}

.scan-form-preview {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    border-radius: 6px;
    border: 1px solid var(--white-light);
    margin-bottom: 1.5rem;
}