/**
 * Dashboard frontend - Gestione Documenti PDF.
 */

.vs-dashboard-wrapper {
    --vs-core-blue: #173b63;
    --vs-core-blue-dark: #102b49;
    --vs-core-blue-soft: #eef5fb;
    --vs-core-orange: #f28c28;
    --vs-core-orange-soft: #fff4e8;
    --vs-core-red: #b94a48;
    --vs-core-red-soft: #fff1f0;
    --vs-core-green: #2f7d5c;
    --vs-core-green-soft: #eaf6f0;
    --vs-core-border: #e5eaf0;
    --vs-core-text: #172033;
    --vs-core-muted: #667085;
    --vs-core-bg: #f7f9fc;
    max-width: 1180px;
    margin: 0 auto;
    padding: 28px 18px 44px;
    color: var(--vs-core-text);
    font-family: inherit;
}

.vs-dashboard-wrapper *,
.vs-dashboard-wrapper *::before,
.vs-dashboard-wrapper *::after {
    box-sizing: border-box;
}

.vs-dashboard-header,
.vs-flyer-section {
    background: #ffffff;
    border: 1px solid var(--vs-core-border);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(16, 43, 73, 0.08);
}

.vs-dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 18px;
    padding: 24px 28px;
    margin-bottom: 22px;
}

.vs-dashboard-header h1 {
    margin: 0;
    color: var(--vs-core-blue);
    font-size: 28px;
    font-weight: 700;
    line-height: 1.2;
}

.vs-dashboard-header-right,
.vs-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.vs-user-name {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 12px;
    border-radius: 999px;
    background: var(--vs-core-blue-soft);
    color: var(--vs-core-blue);
    font-size: 14px;
    font-weight: 650;
}

.vs-alert {
    margin: 0 0 18px;
    padding: 14px 16px;
    border-radius: 8px;
    border: 1px solid var(--vs-core-border);
    font-weight: 600;
}

.vs-alert-success {
    background: var(--vs-core-green-soft);
    border-color: #c8ead8;
    color: var(--vs-core-green);
}

.vs-alert-error {
    background: var(--vs-core-red-soft);
    border-color: #f2c5c2;
    color: var(--vs-core-red);
}

.vs-flyer-section {
    margin-bottom: 24px;
    overflow: hidden;
}

.vs-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--vs-core-border);
    background: linear-gradient(180deg, #ffffff 0%, #fbfdff 100%);
}

.vs-section-title,
.vs-section-title h2 {
    margin: 0;
}

.vs-section-title h2 {
    color: var(--vs-core-blue);
    font-size: 19px;
    font-weight: 700;
    line-height: 1.25;
}

.vs-section-content {
    padding: 24px;
}

.vs-preview-empty {
    padding: 22px;
    border: 1px dashed #cbd5e1;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--vs-core-muted);
    text-align: center;
}

.vs-preview-empty p {
    margin: 0;
}

.vs-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: 7px;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s ease, border-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.vs-btn:focus-visible,
.vs-dashboard-wrapper input:focus,
.vs-dashboard-wrapper select:focus,
.vs-dashboard-wrapper summary:focus-visible {
    outline: 3px solid rgba(242, 140, 40, 0.28);
    outline-offset: 2px;
}

.vs-btn-primary {
    background: var(--vs-core-blue);
    border-color: var(--vs-core-blue);
    color: #ffffff;
    box-shadow: 0 8px 18px rgba(23, 59, 99, 0.18);
}

.vs-btn-primary:hover {
    background: var(--vs-core-blue-dark);
    border-color: var(--vs-core-blue-dark);
    color: #ffffff;
}

.vs-btn-secondary {
    background: #ffffff;
    border-color: #cbd5e1;
    color: var(--vs-core-blue);
}

.vs-btn-secondary:hover {
    background: var(--vs-core-blue-soft);
    border-color: #b7c7d9;
    color: var(--vs-core-blue-dark);
}

.vs-btn-danger {
    background: var(--vs-core-red-soft);
    border-color: #efc4c0;
    color: var(--vs-core-red);
}

.vs-btn-danger:hover {
    background: #f9ddda;
    border-color: #e4aaa5;
    color: #8f302e;
}

.vs-status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 28px;
    padding: 5px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 750;
    line-height: 1;
    white-space: nowrap;
}

.vs-badge-success {
    background: var(--vs-core-green-soft);
    color: var(--vs-core-green);
}

.vs-badge-warning {
    background: var(--vs-core-orange-soft);
    color: #9a5513;
}

.vs-badge-public {
    background: var(--vs-core-blue-soft);
    color: var(--vs-core-blue);
}

.vs-badge-private {
    background: #f2eefb;
    color: #59419a;
}

.vs-pdf-manager-sections {
    display: grid;
    gap: 18px;
}

.vs-pdf-section-list {
    display: grid;
    gap: 12px;
}

.vs-section-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 12px;
    border: 1px solid var(--vs-core-border);
    border-radius: 8px;
    background: #fbfdff;
}

.vs-inline-form,
.vs-add-section-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(145px, 180px) auto;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.vs-delete-section-form {
    grid-template-columns: auto;
    justify-content: end;
}

.vs-add-section-form {
    grid-template-columns: minmax(220px, 1fr) auto;
    padding-top: 16px;
    border-top: 1px solid var(--vs-core-border);
}

.vs-add-section-form input[type="hidden"],
.vs-inline-form input[type="hidden"] {
    display: none;
}

.vs-dashboard-wrapper input[type="text"],
.vs-dashboard-wrapper input[type="url"],
.vs-dashboard-wrapper input[type="number"],
.vs-dashboard-wrapper input[type="file"],
.vs-dashboard-wrapper select {
    width: 100%;
    min-height: 44px;
    border: 1px solid #cfd8e3;
    border-radius: 7px;
    background: #ffffff;
    color: var(--vs-core-text);
    padding: 10px 12px;
    font: inherit;
    font-size: 14px;
}

.vs-dashboard-wrapper input[type="file"] {
    padding: 8px 10px;
}

.vs-dashboard-wrapper label > span,
.vs-cover-field > span {
    color: #344054;
    font-size: 13px;
    font-weight: 750;
}

.vs-dashboard-wrapper small {
    color: var(--vs-core-muted);
    font-size: 12px;
    line-height: 1.45;
}

.vs-pdf-form {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
    align-items: end;
}

.vs-pdf-form label,
.vs-cover-field {
    display: grid;
    gap: 7px;
}

.vs-cover-field {
    grid-column: span 2;
    align-self: stretch;
}

.vs-pdf-form > .vs-btn-primary {
    min-height: 46px;
    align-self: end;
}

.vs-pdf-form-edit {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 14px;
    padding: 18px;
    border: 1px solid var(--vs-core-border);
    border-radius: 8px;
    background: #f8fafc;
}

.vs-pdf-form-edit .vs-cover-field {
    grid-column: 1 / -1;
}

.vs-cover-preview {
    min-height: 132px;
    border: 1px dashed #c7d3df;
    border-radius: 8px;
    background: linear-gradient(180deg, #fbfdff 0%, #f3f7fb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: var(--vs-core-muted);
    text-align: center;
}

.vs-cover-preview img {
    width: 100%;
    height: 150px;
    object-fit: cover;
    display: block;
}

.vs-cover-preview-empty {
    padding: 16px;
}

.vs-cover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.vs-cover-actions .vs-btn {
    min-height: 38px;
    padding: 9px 12px;
}

.vs-document-list {
    display: grid;
    gap: 16px;
}

.vs-document-card {
    border: 1px solid var(--vs-core-border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 10px 26px rgba(16, 43, 73, 0.07);
    overflow: hidden;
}

.vs-document-card-main {
    display: grid;
    grid-template-columns: 148px minmax(0, 1fr) 150px;
    gap: 18px;
    align-items: center;
    padding: 18px;
}

.vs-document-preview {
    width: 148px;
    aspect-ratio: 4 / 3;
    border: 1px solid var(--vs-core-border);
    border-radius: 8px;
    background: linear-gradient(180deg, #f9fbfd 0%, #eef5fb 100%);
    overflow: hidden;
}

.vs-document-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.vs-document-placeholder {
    width: 100%;
    height: 100%;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 8px;
    color: var(--vs-core-muted);
    font-size: 12px;
    font-weight: 750;
    text-transform: uppercase;
}

.vs-document-placeholder-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 58px;
    min-height: 46px;
    border-radius: 7px;
    background: #ffffff;
    color: var(--vs-core-blue);
    box-shadow: 0 8px 18px rgba(16, 43, 73, 0.1);
    font-size: 17px;
    letter-spacing: 0;
}

.vs-document-info {
    min-width: 0;
}

.vs-document-title {
    margin: 0 0 6px;
    color: var(--vs-core-text);
    font-size: 18px;
    font-weight: 800;
    line-height: 1.25;
}

.vs-document-file {
    display: inline-flex;
    max-width: 100%;
    color: var(--vs-core-blue);
    font-size: 13px;
    font-weight: 650;
    overflow-wrap: anywhere;
    text-decoration: none;
}

.vs-document-file:hover {
    color: var(--vs-core-orange);
    text-decoration: underline;
}

.vs-document-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 14px;
    margin-top: 14px;
}

.vs-document-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 30px;
    color: #344054;
    font-size: 13px;
}

.vs-document-meta-item strong {
    color: var(--vs-core-muted);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.vs-document-actions {
    display: grid;
    gap: 10px;
    align-self: stretch;
    align-content: center;
}

.vs-document-actions .vs-btn {
    width: 100%;
}

.vs-delete-document-form {
    margin: 0;
}

.vs-edit-toggle.is-open,
.vs-edit-toggle[aria-expanded="true"] {
    background: var(--vs-core-orange-soft);
    border-color: #f5c28d;
    color: #9a5513;
}

.vs-document-edit-panel {
    padding: 18px;
    border-top: 1px solid var(--vs-core-border);
    background: #f8fafc;
}

.vs-document-edit-panel[hidden] {
    display: none;
}

.vs-access-message {
    max-width: 540px;
    margin: 56px auto;
    padding: 34px;
    border: 1px solid var(--vs-core-border);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 12px 30px rgba(16, 43, 73, 0.08);
    text-align: center;
}

.vs-access-message h2 {
    margin: 0 0 10px;
    color: var(--vs-core-blue);
}

.vs-access-message p {
    margin: 0;
    color: var(--vs-core-muted);
}

@media (max-width: 1024px) {
    .vs-pdf-form {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .vs-pdf-form > .vs-btn-primary,
    .vs-cover-field {
        grid-column: 1 / -1;
    }

    .vs-document-card-main {
        grid-template-columns: 128px minmax(0, 1fr);
    }

    .vs-document-preview {
        width: 128px;
    }

    .vs-document-actions {
        grid-column: 1 / -1;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 760px) {
    .vs-dashboard-wrapper {
        padding: 16px 12px 32px;
    }

    .vs-dashboard-header {
        align-items: flex-start;
        padding: 20px;
    }

    .vs-dashboard-header,
    .vs-dashboard-header-right,
    .vs-user-info {
        flex-direction: column;
    }

    .vs-dashboard-header h1 {
        font-size: 24px;
    }

    .vs-section-header,
    .vs-section-content {
        padding: 18px;
    }

    .vs-inline-form,
    .vs-add-section-form,
    .vs-pdf-form,
    .vs-pdf-form-edit {
        grid-template-columns: 1fr;
    }

    .vs-section-row {
        grid-template-columns: 1fr;
    }

    .vs-add-section-form {
        grid-template-columns: 1fr;
    }

    .vs-inline-form .vs-btn,
    .vs-add-section-form .vs-btn,
    .vs-pdf-form > .vs-btn-primary,
    .vs-cover-actions .vs-btn {
        width: 100%;
    }

    .vs-document-card-main {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .vs-document-preview {
        width: 100%;
        max-width: 240px;
        aspect-ratio: 16 / 10;
    }

    .vs-document-meta {
        display: grid;
        grid-template-columns: 1fr;
        gap: 9px;
    }

    .vs-document-meta-item {
        justify-content: space-between;
        gap: 12px;
        padding: 9px 10px;
        border: 1px solid var(--vs-core-border);
        border-radius: 7px;
        background: #fbfdff;
    }

    .vs-document-actions {
        grid-template-columns: 1fr;
    }

    .vs-document-edit-panel {
        padding: 14px;
    }
}

@media (max-width: 480px) {
    .vs-dashboard-header h1 {
        font-size: 21px;
    }

    .vs-section-title h2 {
        font-size: 17px;
    }

    .vs-section-header,
    .vs-section-content {
        padding: 16px;
    }

    .vs-document-card-main {
        padding: 14px;
    }

    .vs-document-title {
        font-size: 16px;
    }

    .vs-document-meta-item {
        align-items: flex-start;
        flex-direction: column;
    }

    .vs-cover-actions {
        flex-direction: column;
    }
}
