/**
 * SmartPreno — Owner Dashboard Theme Override
 * Version: 2.6.0-dev
 *
 * Complementare a owner-dashboard.css.
 * Aggiunge: palette azzurra (sky), dark mode, bottom bar mobile, toggle tema.
 * Viene caricato DOPO owner-dashboard.css per sovrascrivere le variabili.
 */

/* ============================================ */
/* PALETTE OVERRIDE — indigo → sky              */
/* Sidebar mantenuta scura (stile POS)          */
/* ============================================ */
.smartpreno-owner-dashboard {
    --smartpreno-primary: #0ea5e9;          /* sky-500 */
    --smartpreno-primary-light: #38bdf8;    /* sky-400 */
    --smartpreno-primary-dark: #0369a1;     /* sky-700 */
    --smartpreno-primary-bg: #e0f2fe;       /* sky-100 */
    --smartpreno-sidebar: #0c4a6e;          /* sky-900 scuro blu */
    --smartpreno-sidebar-hover: #075985;    /* sky-800 */
    --smartpreno-sidebar-active: #0ea5e9;

    --smartpreno-mobile-bar: #0ea5e9;
    --smartpreno-mobile-bar-active-bg: rgba(255,255,255,0.22);
    --smartpreno-mobile-bar-active-text: #ffffff;
    --smartpreno-mobile-bar-inactive-text: rgba(255,255,255,0.78);

    color-scheme: light;
}

/* Focus ring sky */
.smartpreno-owner-dashboard .smartpreno-form-group input:focus,
.smartpreno-owner-dashboard .smartpreno-form-group select:focus,
.smartpreno-owner-dashboard .smartpreno-form-group textarea:focus,
.smartpreno-owner-dashboard .filter-group input:focus,
.smartpreno-owner-dashboard .filter-group select:focus {
    box-shadow: 0 0 0 3px rgba(14,165,233,0.15) !important;
}

/* ============================================ */
/* DARK MODE                                    */
/* Attivato da [data-theme="dark"]              */
/* ============================================ */
.smartpreno-owner-dashboard[data-theme="dark"] {
    --smartpreno-primary: #38bdf8;
    --smartpreno-primary-light: #7dd3fc;
    --smartpreno-primary-dark: #0ea5e9;
    --smartpreno-primary-bg: #0c4a6e;

    --smartpreno-sidebar: #0f172a;
    --smartpreno-sidebar-hover: #1e293b;
    --smartpreno-sidebar-active: #38bdf8;

    --smartpreno-success: #10b981;
    --smartpreno-success-bg: #064e3b;
    --smartpreno-warning: #f59e0b;
    --smartpreno-warning-bg: #451a03;
    --smartpreno-danger: #f87171;
    --smartpreno-danger-bg: #450a0a;
    --smartpreno-info: #38bdf8;
    --smartpreno-info-bg: #0c4a6e;
    --smartpreno-seated: #a78bfa;
    --smartpreno-seated-bg: #2e1065;
    --smartpreno-timed: #fb923c;
    --smartpreno-timed-bg: #431407;

    --smartpreno-text: #f1f5f9;
    --smartpreno-text-light: #cbd5e1;
    --smartpreno-text-muted: #94a3b8;
    --smartpreno-border: #334155;
    --smartpreno-bg: #020617;
    --smartpreno-white: #1e293b;

    --smartpreno-mobile-bar: #0284c7;

    --smartpreno-shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.2);
    --smartpreno-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.2);
    --smartpreno-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4), 0 4px 6px -4px rgba(0,0,0,0.2);

    color-scheme: dark;
}

/* Modal overlay più scuro in dark mode */
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-modal-overlay {
    background: rgba(0,0,0,0.75);
}

/* Status badge leggibilità in dark mode */
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-badge-success {
    background: rgba(16,185,129,0.18);
    color: #6ee7b7;
}
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-badge-warning {
    background: rgba(245,158,11,0.18);
    color: #fcd34d;
}
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-badge-danger {
    background: rgba(248,113,113,0.18);
    color: #fca5a5;
}
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-badge-info {
    background: rgba(56,189,248,0.18);
    color: #7dd3fc;
}
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-badge-seated {
    background: rgba(167,139,250,0.18);
    color: #c4b5fd;
}
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-badge-secondary {
    background: #334155;
    color: #cbd5e1;
}

/* Dashboard message in dark mode */
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-dashboard-message.success {
    background: rgba(16,185,129,0.12);
    color: #6ee7b7;
    border-color: rgba(16,185,129,0.3);
}
.smartpreno-owner-dashboard[data-theme="dark"] .smartpreno-dashboard-message.error {
    background: rgba(248,113,113,0.12);
    color: #fca5a5;
    border-color: rgba(248,113,113,0.3);
}

/* Scrollbar dark */
.smartpreno-owner-dashboard[data-theme="dark"] *::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}
.smartpreno-owner-dashboard[data-theme="dark"] *::-webkit-scrollbar-track {
    background: var(--smartpreno-bg);
}
.smartpreno-owner-dashboard[data-theme="dark"] *::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 5px;
}
.smartpreno-owner-dashboard[data-theme="dark"] *::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Inputs in dark mode */
.smartpreno-owner-dashboard[data-theme="dark"] input[type="text"],
.smartpreno-owner-dashboard[data-theme="dark"] input[type="tel"],
.smartpreno-owner-dashboard[data-theme="dark"] input[type="email"],
.smartpreno-owner-dashboard[data-theme="dark"] input[type="number"],
.smartpreno-owner-dashboard[data-theme="dark"] input[type="date"],
.smartpreno-owner-dashboard[data-theme="dark"] input[type="time"],
.smartpreno-owner-dashboard[data-theme="dark"] input[type="password"],
.smartpreno-owner-dashboard[data-theme="dark"] input[type="search"],
.smartpreno-owner-dashboard[data-theme="dark"] select,
.smartpreno-owner-dashboard[data-theme="dark"] textarea {
    background: #0f172a;
    color: var(--smartpreno-text);
    border-color: var(--smartpreno-border);
}
.smartpreno-owner-dashboard[data-theme="dark"] input::placeholder,
.smartpreno-owner-dashboard[data-theme="dark"] textarea::placeholder {
    color: var(--smartpreno-text-muted);
}

/* FullCalendar adattamento dark */
.smartpreno-owner-dashboard[data-theme="dark"] .fc {
    color: var(--smartpreno-text);
}
.smartpreno-owner-dashboard[data-theme="dark"] .fc-theme-standard td,
.smartpreno-owner-dashboard[data-theme="dark"] .fc-theme-standard th,
.smartpreno-owner-dashboard[data-theme="dark"] .fc-theme-standard .fc-scrollgrid {
    border-color: var(--smartpreno-border);
}
.smartpreno-owner-dashboard[data-theme="dark"] .fc-col-header-cell,
.smartpreno-owner-dashboard[data-theme="dark"] .fc-list-day-cushion {
    background: #1e293b !important;
    color: var(--smartpreno-text);
}
.smartpreno-owner-dashboard[data-theme="dark"] .fc-day-today {
    background: rgba(56,189,248,0.08) !important;
}

/* ============================================ */
/* THEME TOGGLE — sidebar footer button         */
/* ============================================ */
.smartpreno-theme-toggle {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.75);
    border: none;
    border-radius: var(--smartpreno-radius-sm);
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: var(--smartpreno-transition);
    margin-bottom: 8px;
    font-family: inherit;
}
.smartpreno-theme-toggle:hover {
    background: rgba(255,255,255,0.14);
    color: #fff;
}
.smartpreno-theme-toggle .theme-icon {
    font-size: 1.1rem;
    line-height: 1;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
}

/* Sidebar compatta (tablet): solo icona */
@media screen and (max-width: 1024px) {
    .smartpreno-theme-toggle {
        justify-content: center;
        padding: 12px 8px;
    }
    .smartpreno-theme-toggle .theme-label {
        display: none;
    }
}

/* ============================================ */
/* BOTTOM BAR MOBILE                            */
/* ============================================ */
.smartpreno-bottom-bar {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 90;
    background: var(--smartpreno-mobile-bar);
    padding: 8px 4px 10px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0,0,0,0.14);
    justify-content: space-around;
    align-items: stretch;
    gap: 2px;
}
.smartpreno-bottom-bar a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 4px;
    min-width: 0;
    flex: 1;
    max-width: 80px;
    text-decoration: none;
    color: var(--smartpreno-mobile-bar-inactive-text);
    border-radius: 10px;
    transition: background 0.15s ease, transform 0.15s ease;
    position: relative;
    cursor: pointer;
}
.smartpreno-bottom-bar a:active {
    transform: scale(0.92);
}
.smartpreno-bottom-bar a.active {
    color: var(--smartpreno-mobile-bar-active-text);
    background: var(--smartpreno-mobile-bar-active-bg);
}
.smartpreno-bottom-bar .bar-icon {
    font-size: 1.35rem;
    line-height: 1;
    filter: grayscale(1) brightness(2);
}
.smartpreno-bottom-bar a.active .bar-icon {
    filter: grayscale(0) brightness(1.1);
}
.smartpreno-bottom-bar .bar-label {
    font-size: 0.66rem;
    letter-spacing: 0.2px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}
.smartpreno-bottom-bar a.active .bar-label {
    font-weight: 600;
}
.smartpreno-bottom-bar .bar-badge {
    position: absolute;
    top: 2px;
    right: calc(50% - 20px);
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: #fff;
    border-radius: 8px;
    font-size: 0.62rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--smartpreno-mobile-bar);
    line-height: 1;
}

/* Drawer "Menu" */
.smartpreno-mobile-drawer {
    display: none;
    position: fixed;
    bottom: calc(76px + env(safe-area-inset-bottom));
    left: 12px;
    right: 12px;
    z-index: 91;
    background: var(--smartpreno-white);
    border: 1px solid var(--smartpreno-border);
    border-radius: var(--smartpreno-radius);
    box-shadow: 0 10px 25px rgba(0,0,0,0.18), 0 4px 10px rgba(0,0,0,0.1);
    padding: 6px;
    animation: smartprenoDrawerSlide 0.22s ease;
    max-height: 60vh;
    overflow-y: auto;
}
@keyframes smartprenoDrawerSlide {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.smartpreno-mobile-drawer.open { display: block; }
.smartpreno-mobile-drawer a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    color: var(--smartpreno-text);
    text-decoration: none;
    border-radius: var(--smartpreno-radius-sm);
    font-size: 0.92rem;
    font-weight: 500;
}
.smartpreno-mobile-drawer a:active {
    background: var(--smartpreno-bg);
}
.smartpreno-mobile-drawer a.active {
    background: var(--smartpreno-primary-bg);
    color: var(--smartpreno-primary);
}
.smartpreno-mobile-drawer a .nav-icon {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}
.smartpreno-mobile-drawer-backdrop {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 90;
    background: rgba(0,0,0,0.3);
    animation: smartprenoFadeIn 0.18s ease;
}
@keyframes smartprenoFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.smartpreno-mobile-drawer-backdrop.open { display: block; }

/* ============================================ */
/* MOBILE ACTIVATION (< 768px)                  */
/* ============================================ */
@media screen and (max-width: 768px) {
    .smartpreno-owner-dashboard .smartpreno-mobile-nav {
        display: none !important;
    }
    .smartpreno-owner-dashboard .smartpreno-bottom-bar {
        display: flex;
    }
    /* Spazio per bottom bar (72px) + pulsante AI sopra (~56px alto, +88px dal basso) + margine = 170px */
    .smartpreno-owner-dashboard .smartpreno-main {
        padding-bottom: calc(170px + env(safe-area-inset-bottom)) !important;
    }
}

/* Schermi molto piccoli (< 480px): il pulsante AI è full-width, serve un pelo più di spazio */
@media screen and (max-width: 480px) {
    .smartpreno-owner-dashboard .smartpreno-main {
        padding-bottom: calc(180px + env(safe-area-inset-bottom)) !important;
    }
}

/* ============================================ */
/* TRANSIZIONI TEMA                             */
/* ============================================ */
.smartpreno-owner-dashboard,
.smartpreno-owner-dashboard .smartpreno-main,
.smartpreno-owner-dashboard .smartpreno-sidebar,
.smartpreno-owner-dashboard .smartpreno-dashboard-table,
.smartpreno-owner-dashboard .booking-card,
.smartpreno-owner-dashboard .finder-card,
.smartpreno-owner-dashboard .live-stat-card,
.smartpreno-owner-dashboard .smartpreno-filters-box,
.smartpreno-owner-dashboard .smartpreno-modal-content,
.smartpreno-owner-dashboard .analytics-chart-box,
.smartpreno-owner-dashboard input,
.smartpreno-owner-dashboard select,
.smartpreno-owner-dashboard textarea,
.smartpreno-owner-dashboard .smartpreno-btn {
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
