/* ============================================================
   PrenoTaglio — Admin CSS
   ============================================================ */

:root {
    --color-primary: #1a1a2e;
    --color-secondary: #16213e;
    --sidebar-width: 260px;
    --header-height: 60px;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-danger: #ef4444;
    --color-info: #3b82f6;
    --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
    --shadow-md: 0 4px 16px rgba(0,0,0,.12);
    --border-radius: 10px;
    --transition: .2s ease;
}

*, *::before, *::after { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f3f4f6;
    color: #111827;
    margin: 0;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ────────────────────────────────────────────────────────────
   Layout Admin
   ──────────────────────────────────────────────────────────── */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

/* ────────────────────────────────────────────────────────────
   Sidebar
   ──────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--color-primary);
    color: #fff;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 200;
    transition: transform var(--transition);
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar-brand-name {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -.5px;
}

.sidebar-brand-tenant {
    font-size: .8rem;
    opacity: .6;
    margin-top: 2px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: rgba(255,255,255,.75);
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    font-size: .95rem;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    border-radius: 0;
}

.sidebar-nav-item:hover,
.sidebar-nav-item.active {
    background: rgba(255,255,255,.1);
    color: #fff;
}

.sidebar-nav-item.active {
    border-right: 3px solid #fff;
}

.sidebar-nav-icon { font-size: 1.2rem; flex-shrink: 0; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,.1);
    font-size: .85rem;
    opacity: .6;
}

/* Overlay mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 199;
}

/* ────────────────────────────────────────────────────────────
   Main Content
   ──────────────────────────────────────────────────────────── */
.admin-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Header top bar */
.admin-topbar {
    height: var(--header-height);
    background: #fff;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-topbar-title {
    font-size: 1.1rem;
    font-weight: 700;
}

.admin-topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .9rem;
    color: #6b7280;
}

.hamburger-btn {
    display: none;
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--color-primary);
    margin-right: 12px;
}

.admin-page {
    padding: 24px;
    flex: 1;
}

/* ────────────────────────────────────────────────────────────
   Cards statistiche dashboard
   ──────────────────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border-radius: var(--border-radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.stat-icon-blue    { background: #dbeafe; }
.stat-icon-green   { background: #d1fae5; }
.stat-icon-yellow  { background: #fef3c7; }
.stat-icon-purple  { background: #ede9fe; }

.stat-info {}
.stat-value {
    font-size: 1.75rem;
    font-weight: 800;
    color: #111827;
    line-height: 1;
}
.stat-label {
    font-size: .8rem;
    color: #6b7280;
    margin-top: 3px;
    font-weight: 500;
}

/* ────────────────────────────────────────────────────────────
   Tabelle prenotazioni
   ──────────────────────────────────────────────────────────── */
.table-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid #f3f4f6;
}

.table-title {
    font-size: 1rem;
    font-weight: 700;
}

.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}

thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
    background: #f9fafb;
    border-bottom: 1px solid #f3f4f6;
}

tbody td {
    padding: 12px 16px;
    border-bottom: 1px solid #f9fafb;
    color: #374151;
    vertical-align: middle;
}

tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }

/* ────────────────────────────────────────────────────────────
   Badges stato prenotazione
   ──────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}

.badge-confermata { background: #dbeafe; color: #1e40af; }
.badge-completata { background: #d1fae5; color: #065f46; }
.badge-cancellata { background: #f3f4f6; color: #6b7280; }
.badge-no_show    { background: #fee2e2; color: #991b1b; }

/* ────────────────────────────────────────────────────────────
   Form gestione servizi
   ──────────────────────────────────────────────────────────── */
.form-card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    margin-bottom: 20px;
}

.form-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f3f4f6;
}

.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    font-size: .875rem;
    color: #374151;
}

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    transition: border-color var(--transition);
    background: #fff;
    color: #111827;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-textarea { resize: vertical; min-height: 80px; }

.form-hint {
    font-size: .78rem;
    color: #9ca3af;
    margin-top: 4px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Upload area */
.upload-area {
    border: 2px dashed #d1d5db;
    border-radius: 10px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color var(--transition), background var(--transition);
}

.upload-area:hover {
    border-color: var(--color-primary);
    background: #f9fafb;
}

.upload-area .upload-icon { font-size: 2rem; color: #9ca3af; margin-bottom: 8px; }
.upload-area .upload-text { font-size: .875rem; color: #6b7280; }
.upload-preview {
    width: 100%;
    max-height: 160px;
    object-fit: cover;
    border-radius: 8px;
    margin-top: 12px;
}

/* ────────────────────────────────────────────────────────────
   Toggle switch orari
   ──────────────────────────────────────────────────────────── */
.toggle-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle {
    position: relative;
    width: 46px;
    height: 26px;
    flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.toggle-slider {
    position: absolute;
    inset: 0;
    background: #d1d5db;
    border-radius: 13px;
    cursor: pointer;
    transition: background var(--transition);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: transform var(--transition);
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}

.toggle input:checked + .toggle-slider { background: var(--color-success); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

.toggle-label { font-weight: 600; font-size: .95rem; color: #374151; }

/* Griglia orari settimana */
.orari-grid { display: flex; flex-direction: column; gap: 12px; }

.orario-row {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.orario-giorno {
    width: 110px;
    font-weight: 700;
    font-size: .95rem;
    flex-shrink: 0;
}

.orario-times {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    flex: 1;
}

.orario-times .form-input {
    width: 110px;
    padding: 8px 10px;
}

.orario-closed {
    opacity: .5;
    pointer-events: none;
}

/* ────────────────────────────────────────────────────────────
   Modal conferma
   ──────────────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal {
    background: #fff;
    border-radius: 14px;
    box-shadow: var(--shadow-lg, 0 20px 60px rgba(0,0,0,.2));
    padding: 28px 24px;
    width: 100%;
    max-width: 460px;
    animation: modalIn .2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(.96) translateY(8px); }
    to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 12px;
}

.modal-body {
    color: #6b7280;
    font-size: .9rem;
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ────────────────────────────────────────────────────────────
   Bottoni admin
   ──────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 18px;
    border-radius: 8px;
    font-size: .875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: opacity var(--transition), transform var(--transition);
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
}

.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary   { background: var(--color-primary); color: #fff; }
.btn-success   { background: var(--color-success); color: #fff; }
.btn-danger    { background: var(--color-danger); color: #fff; }
.btn-warning   { background: var(--color-warning); color: #fff; }
.btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.btn-icon      { padding: 8px; border-radius: 6px; }

.btn:hover:not(:disabled) { opacity: .85; }

/* ────────────────────────────────────────────────────────────
   Alert
   ──────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: .9rem;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #a7f3d0; }
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.alert-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }

/* ────────────────────────────────────────────────────────────
   FullCalendar overrides
   ──────────────────────────────────────────────────────────── */
.fc {
    font-family: inherit;
    font-size: .875rem;
}

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

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

.fc .fc-daygrid-event,
.fc .fc-timegrid-event {
    border-radius: 4px;
    font-size: .78rem;
}

.fc .fc-col-header-cell-cushion { font-weight: 700; }
.fc .fc-toolbar-title { font-size: 1rem; font-weight: 700; }

/* ────────────────────────────────────────────────────────────
   Paginazione
   ──────────────────────────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    padding: 16px;
}

.page-btn {
    min-width: 36px;
    height: 36px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #fff;
    color: #374151;
    font-size: .875rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.page-btn.active {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: #fff;
}

.page-btn:hover:not(.active):not(:disabled) { background: #f3f4f6; }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ────────────────────────────────────────────────────────────
   Login screen admin
   ──────────────────────────────────────────────────────────── */
.admin-login {
    min-height: 100vh;
    background: var(--color-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.admin-login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 32px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.admin-login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.admin-login-title { font-size: 1.5rem; font-weight: 800; color: #111827; margin-bottom: 4px; }
.admin-login-sub { font-size: .875rem; color: #6b7280; }

/* ────────────────────────────────────────────────────────────
   Responsive
   ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar-overlay.open {
        display: block;
    }

    .admin-content {
        margin-left: 0;
    }

    .hamburger-btn { display: flex; }

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

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

    .orario-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .admin-page { padding: 16px; }
    .modal-actions { flex-direction: column; }
}

/* ────────────────────────────────────────────────────────────
   Transizioni Vue
   ──────────────────────────────────────────────────────────── */
.fade-enter-active, .fade-leave-active { transition: opacity .2s; }
.fade-enter-from, .fade-leave-to { opacity: 0; }

.slide-enter-active, .slide-leave-active {
    transition: all .25s ease;
}
.slide-enter-from { transform: translateX(-10px); opacity: 0; }
.slide-leave-to   { transform: translateX(10px);  opacity: 0; }

/* Spinner */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid rgba(0,0,0,.1);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Chiusure list */
.chiusure-list { display: flex; flex-direction: column; gap: 10px; }
.chiusura-item {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
    padding: 14px 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.chiusura-dates { font-weight: 600; font-size: .9rem; }
.chiusura-motivo { font-size: .8rem; color: #6b7280; margin-top: 2px; }

/* ============================================================
   Real-time: Toast notifications + Live badge
   ============================================================ */

/* Toast container */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    padding: 12px 18px;
    border-radius: 10px;
    font-size: .875rem;
    font-weight: 600;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    pointer-events: auto;
    min-width: 220px;
    max-width: 320px;
}

.toast-success { background: #10b981; }
.toast-info    { background: #3b82f6; }
.toast-warning { background: #f59e0b; }
.toast-error   { background: #ef4444; }

/* Toast animations */
.toast-enter-active { transition: all .3s ease; }
.toast-leave-active { transition: all .3s ease; }
.toast-enter-from   { opacity: 0; transform: translateX(40px); }
.toast-leave-to     { opacity: 0; transform: translateX(40px); }

/* Live badge */
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: .05em;
    color: #10b981;
    background: rgba(16,185,129,.12);
    border: 1px solid rgba(16,185,129,.3);
    border-radius: 20px;
    padding: 2px 8px;
}

.live-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #10b981;
    animation: pulse-live 1.5s infinite;
    display: inline-block;
}

@keyframes pulse-live {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .4; transform: scale(.7); }
}
