﻿
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700;800&display=swap');

:root {
    --background: #f5f7fb;
    --surface: #ffffff;
    --primary: #4778df;
    --primary-dark: #315fc0;
    --text: #202b3c;
    --muted: #8994a6;
    --border: #e9edf4;
    --radius: 18px;
}

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

body {
    background: var(--background);
    color: var(--text);
    font-family: 'DM Sans', sans-serif;
    min-height: 100vh;
}

button {
    font: inherit;
    cursor: pointer;
    border: none;
}

.app-container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 48px;
}

.topbar {
    height: 82px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 19px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: var(--primary);
    color: white;
    display: grid;
    place-items: center;
    font-size: 25px;
}

.profile-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: white;
    border: 1px solid var(--border);
}

main {
    padding: 54px 0 70px;
}

.welcome {
    margin-bottom: 34px;
}

.eyebrow {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--primary);
}

.welcome h1 {
    font-size: clamp(30px, 4vw, 40px);
    letter-spacing: -1.5px;
    margin: 9px 0;
}

.welcome p,
.section-heading p {
    color: var(--muted);
    font-size: 14px;
}

.summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin-bottom: 55px;
}

.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    display: flex;
    align-items: center;
    gap: 17px;
}

.summary-icon {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    background: #edf3ff;
    border-radius: 14px;
    font-size: 22px;
}

.summary-card div {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.summary-card strong {
    font-size: 23px;
}

.summary-card div span {
    font-size: 12px;
    color: var(--muted);
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    gap: 16px;
}

.section-heading h2 {
    font-size: 21px;
    letter-spacing: -0.5px;
    margin-bottom: 5px;
}

.add-button {
    padding: 11px 17px;
    border-radius: 11px;
    background: var(--primary);
    color: white;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.add-button:hover,
.primary-button:hover {
    background: var(--primary-dark);
}

.rooms-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.empty-state {
    grid-column: 1 / -1;
    background: white;
    border: 1px dashed #d6deeb;
    border-radius: var(--radius);
    padding: 55px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 42px;
    margin-bottom: 14px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    color: var(--muted);
    font-size: 13px;
    max-width: 360px;
    margin: 0 auto 22px;
    line-height: 1.6;
}

.primary-button {
    background: var(--primary);
    color: white;
    padding: 12px 19px;
    border-radius: 11px;
    font-weight: 600;
    font-size: 13px;
}

footer {
    border-top: 1px solid var(--border);
    padding: 22px 0;
    display: flex;
    justify-content: space-between;
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 700px) {
    .app-container {
        padding: 0 20px;
    }

    .topbar {
        height: 68px;
    }

    main {
        padding: 35px 0 45px;
    }

    .summary {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 40px;
    }

    .summary-card {
        padding: 15px;
    }

    .rooms-grid {
        grid-template-columns: 1fr;
    }

    .section-heading {
        align-items: flex-start;
    }

    .add-button {
        white-space: nowrap;
    }

    footer {
        flex-direction: column;
        gap: 7px;
    }
}


/* ROOM CARDS */

.room-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.room-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(35, 55, 90, 0.07);
}

.room-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.room-icon {
    width: 54px;
    height: 54px;
    background: #edf3ff;
    border-radius: 16px;
    display: grid;
    place-items: center;
    font-size: 27px;
}

.delete-room {
    background: transparent;
    color: #a3adbd;
    font-size: 25px;
    line-height: 1;
}

.delete-room:hover {
    color: #e45c67;
}

.room-card-info {
    margin: 24px 0 20px;
}

.room-card-info h3 {
    font-size: 17px;
    margin-bottom: 5px;
}

.room-card-info p {
    color: var(--muted);
    font-size: 12px;
}

.room-card-bottom {
    border-top: 1px solid var(--border);
    padding-top: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
}

.room-arrow {
    font-size: 19px;
}

/* ROOM DIALOG */

.dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(25, 36, 55, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

.room-dialog {
    background: white;
    width: 100%;
    max-width: 440px;
    border-radius: 22px;
    padding: 28px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    max-height: 90vh;
    overflow-y: auto;
}

.dialog-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 27px;
}

.dialog-header h2 {
    font-size: 21px;
    margin-bottom: 5px;
}

.dialog-header p {
    color: var(--muted);
    font-size: 12px;
}

.dialog-close {
    background: transparent;
    color: var(--muted);
    font-size: 26px;
    align-self: flex-start;
}

.room-dialog label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 10px;
}

.room-dialog input {
    width: 100%;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    font: inherit;
    margin-bottom: 23px;
}

.room-dialog input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(71, 120, 223, 0.1);
}

.icon-picker {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 9px;
}

.icon-option {
    aspect-ratio: 1;
    border-radius: 12px;
    background: #f5f7fb;
    font-size: 23px;
    border: 2px solid transparent;
}

.icon-option.selected {
    background: #edf3ff;
    border-color: var(--primary);
}

.dialog-error {
    color: #d94b57;
    font-size: 12px;
    margin-top: 12px;
    min-height: 16px;
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.cancel-button {
    background: #f2f4f8;
    color: var(--text);
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
}

.dialog-actions .primary-button {
    border: none;
}

@media (max-width: 480px) {
    .room-dialog {
        padding: 22px;
    }

    .icon-picker {
        grid-template-columns: repeat(4, 1fr);
    }
}


/* NAVIGAZIONE STANZE */

.back-button {
    display: block;
    background: transparent;
    color: var(--primary);
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 12px;
    padding: 0;
}

.back-button:hover {
    color: var(--primary-dark);
}

.section-heading h2 {
    margin-top: 3px;
}

/* CONTENITORI */

.container-card {
    min-height: 205px;
}

.container-card .room-icon {
    background: #f1efff;
}

.container-card .room-card-info {
    margin-top: 20px;
}

.container-card .room-card-bottom {
    color: var(--muted);
}


/* CONTENUTO DEI CONTENITORI */

.heading-actions {
    display: flex;
    gap: 9px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.secondary-add {
    background: #e9effb;
    color: var(--primary);
}

.secondary-add:hover {
    background: #dce7fa;
}

.content-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 8px 0 18px;
}

.content-section-title h3 {
    font-size: 16px;
}

.content-section-title > span {
    background: #e9effb;
    color: var(--primary);
    border-radius: 20px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 700;
}

.section-card .room-icon {
    background: #f1efff;
}

.item-title {
    margin-top: 35px;
}

.item-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.item-row {
    background: white;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 15px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
}

.item-symbol {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #edf3ff;
    display: grid;
    place-items: center;
    font-size: 20px;
    flex-shrink: 0;
}

.item-details {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
    min-width: 0;
}

.item-details strong {
    font-size: 14px;
}

.item-details span,
.item-details small {
    color: var(--muted);
    font-size: 12px;
}

.delete-item {
    background: transparent;
    color: #a3adbd;
    font-size: 23px;
    padding: 5px;
}

.delete-item:hover {
    color: #e45c67;
}

.empty-actions {
    display: flex;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

.room-dialog textarea {
    width: 100%;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    font: inherit;
    font-size: 13px;
    resize: vertical;
    margin-bottom: 18px;
}

.room-dialog textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(71, 120, 223, 0.1);
}

@media (max-width: 700px) {
    .heading-actions {
        justify-content: flex-start;
    }
}

@media (max-width: 480px) {
    .heading-actions .add-button {
        font-size: 11px;
        padding: 10px 12px;
    }
}

/* GLOBAL SEARCH */

.global-search {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    max-width: 620px;
    height: 54px;
    margin-top: 26px;
    padding: 0 17px;
    background: white;
    border: 1px solid var(--border);
    border-radius: 15px;
    box-shadow: 0 4px 16px rgba(32, 43, 60, 0.035);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.global-search:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(71, 120, 223, 0.1);
}

.search-icon {
    color: var(--muted);
    font-size: 27px;
    line-height: 1;
}

.global-search input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    outline: none;
    background: transparent;
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

.global-search input::placeholder {
    color: #a3adbd;
}

.global-search input::-webkit-search-cancel-button {
    display: none;
}

.clear-search {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #f0f3f8;
    color: var(--muted);
    font-size: 19px;
    display: grid;
    place-items: center;
}

.clear-search:hover {
    background: #e5eaf2;
    color: var(--text);
}

.clear-search[hidden] {
    display: none;
}

@media (max-width: 480px) {
    .global-search {
        height: 49px;
        margin-top: 20px;
        padding: 0 13px;
    }

    .global-search input {
        font-size: 13px;
    }
}


/* HISTORY UI */

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-button {
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}

.history-button:hover {
    background: var(--background);
    border-color: var(--primary);
}

.history-section {
    padding-bottom: 40px;
}

.history-heading {
    margin-bottom: 24px;
}

.history-filters {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 200px 200px;
    gap: 12px;
    margin-bottom: 24px;
}

.history-filters input,
.history-filters select {
    width: 100%;
    min-width: 0;
    height: 44px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
    color: inherit;
    font: inherit;
    font-size: 14px;
}

.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.history-entry {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: white;
}

.history-entry-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.history-entry-info {
    min-width: 0;
}

.history-action {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.history-entry h3 {
    margin: 0 0 6px;
    font-size: 16px;
}

.history-entry p {
    margin: 4px 0;
    color: var(--text-secondary);
    font-size: 13px;
    overflow-wrap: anywhere;
}

.history-entry time {
    display: block;
    margin-top: 12px;
    color: var(--text-secondary);
    font-size: 12px;
}

.history-details {
    flex-shrink: 0;
    font-size: 13px;
}

.history-details summary {
    color: var(--primary);
    font-weight: 600;
    cursor: pointer;
}

.history-details pre {
    max-width: min(600px, 70vw);
    max-height: 300px;
    margin-top: 12px;
    padding: 14px;
    overflow: auto;
    border-radius: 8px;
    background: #f5f7fb;
    color: #334155;
    font-family: Consolas, monospace;
    font-size: 11px;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

@media (max-width: 700px) {
    .topbar-actions {
        gap: 8px;
    }

    .history-button {
        padding: 0 12px;
        font-size: 12px;
    }

    .history-filters {
        grid-template-columns: 1fr;
    }

    .history-entry-main {
        flex-direction: column;
        gap: 16px;
    }

    .history-details pre {
        max-width: 100%;
    }

    .history-heading {
        align-items: flex-start;
        gap: 12px;
    }
}


/* HISTORY RESTORE */

.history-entry-actions {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    flex-shrink: 0;
}

.history-restore {
    padding: 8px 13px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: white;
    color: var(--primary);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}

.history-restore:hover {
    border-color: var(--primary);
    background: var(--background);
}

.history-restored {
    padding: 8px 13px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 600;
}

@media (max-width: 700px) {
    .history-entry-actions {
        flex-wrap: wrap;
    }
}

/* HOMEINVENTORY - ZAINI */
.welcome[hidden],
.summary[hidden],
.rooms-section[hidden],
#backpacks-section[hidden] {
    display: none !important;
}

.backpack-search {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    max-width: 620px;
    min-height: 50px;
    margin: 20px 0;
    padding: 0 15px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--muted);
}

.backpack-search input {
    flex: 1;
    min-width: 0;
    height: 48px;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
}

.backpack-search-result {
    padding: 14px;
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface);
    overflow-wrap: anywhere;
}

.backpack-search-result p {
    margin: 7px 0;
    color: var(--muted);
}

@media (max-width: 700px) {
    #backpacks-section > div {
        padding: 12px 0 !important;
    }

    #backpacks-section h1 {
        font-size: 26px;
    }

    #backpacks-section article {
        max-width: 100%;
        box-sizing: border-box;
    }

    #backpacks-section button {
        min-height: 42px;
        margin: 4px 4px 4px 0;
    }

    .backpack-search {
        max-width: none;
        box-sizing: border-box;
        min-height: 48px;
        margin: 16px 0;
    }

    .backpack-search input {
        font-size: 16px;
    }
}
/* HOMEINVENTORY - ZAINI MOBILE */

.backpacks-container {
    width: 100%;
    min-width: 0;
    padding: 20px 0;
}

#backpacks-section h1,
#backpacks-section h2,
#backpacks-section p,
#backpacks-section strong,
#backpacks-section span {
    overflow-wrap: anywhere;
}

.backpack-card,
.backpack-item-card {
    width: 100%;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    overflow-wrap: anywhere;
}

.backpack-card {
    padding: 18px;
    margin: 12px 0;
}

.backpack-item-card {
    padding: 16px;
    margin: 10px 0;
}

.backpack-card p,
.backpack-item-card p {
    margin: 8px 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

#backpacks-section button {
    min-height: 42px;
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}

#backpacks-section article button {
    margin: 8px 6px 0 0;
}

@media (max-width: 700px) {
    .backpacks-container {
        padding: 10px 0;
    }

    #backpacks-section h1 {
        font-size: 27px;
        letter-spacing: -0.8px;
        margin: 12px 0 6px;
    }

    #backpacks-section h2 {
        font-size: 21px;
        margin: 18px 0 12px;
    }

    #backpacks-section p {
        font-size: 14px;
        line-height: 1.5;
    }

    #backpacks-section button {
        min-height: 46px;
        padding: 10px 14px;
        font-size: 14px;
    }

    #backpacks-section article button {
        margin: 10px 6px 0 0;
    }

    .backpack-card {
        padding: 16px;
        margin: 10px 0;
    }

    .backpack-item-card {
        padding: 14px;
        margin: 10px 0;
    }

    .backpack-search {
        width: 100%;
        min-height: 50px;
        margin: 18px 0;
    }

    .backpack-search input {
        font-size: 16px;
    }

    #backpack-status {
        overflow-wrap: anywhere;
    }
}

@media (max-width: 380px) {
    #backpacks-section button {
        padding: 9px 11px;
        font-size: 13px;
    }
}
/* HOMEINVENTORY - ZAINI E HEADER */

.backpacks-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 6px;
}

.backpacks-title-row h1 {
    margin: 0 !important;
}

.backpack-add-icon {
    width: 32px;
    height: 32px;
    min-height: 32px !important;
    padding: 0 !important;
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    font-size: 22px !important;
    line-height: 1;
}

.backpack-delete-button {
    min-height: 32px !important;
    padding: 5px 9px !important;
    font-size: 11px !important;
    opacity: 0.8;
}

@media (max-width: 700px) {
    .topbar {
        gap: 8px;
        min-width: 0;
    }

    .brand {
        gap: 8px;
        min-width: 0;
        flex-shrink: 1;
        font-size: 16px;
        letter-spacing: -0.4px;
    }

    .brand-icon {
        width: 34px;
        height: 34px;
        flex-shrink: 0;
    }

    .topbar-actions {
        gap: 6px;
        flex-shrink: 0;
    }

    .history-button {
        height: 38px;
        padding: 0 9px;
        font-size: 11px;
        white-space: nowrap;
    }

    .profile-button {
        width: 36px;
        height: 36px;
        flex-shrink: 0;
    }

    .backpacks-title-row {
        gap: 10px;
    }

    .backpack-add-icon {
        width: 32px;
        height: 32px;
    }
}
/* HOMEINVENTORY - DIMENSIONE DEFINITIVA PULSANTE + */
#backpacks-section .backpacks-title-row .backpack-add-icon {
    width: 24px !important;
    height: 24px !important;
    min-width: 24px !important;
    min-height: 24px !important;
    padding: 0 !important;
    font-size: 16px !important;
    line-height: 1 !important;
    box-sizing: border-box !important;
}