/* Sluurpy Ristoratori - Gestionale Layout System */

:root {
    --sidebar-w: 260px;
    --sidebar-bg: #111827;
    --sidebar-hover: rgba(255, 255, 255, 0.06);
    --sidebar-active-bg: rgba(236, 114, 5, 0.12);
    --sidebar-active-border: #ec7205;
    --sidebar-text: #9ca3af;
    --sidebar-text-active: #ffffff;
    --sidebar-label: #6b7280;
    --brand: #ec7205;
    --brand-light: #ff8c42;
    --content-bg: #f3f4f6;
    --card-bg: #ffffff;
    --text-1: #111827;
    --text-2: #6b7280;
    --border: #e5e7eb;
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --speed: 200ms;
}

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

html {
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--content-bg);
    min-height: 100vh;
    color: var(--text-1);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===== APP SHELL ===== */
.app-shell {
    display: flex;
    min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transition: transform var(--speed) ease;
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.08) transparent;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* Brand */
.sb-brand {
    padding: 20px 20px 16px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sb-brand a {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    font-size: 17px;
    letter-spacing: -0.3px;
}

.sb-brand svg { flex-shrink: 0; }

/* Restaurant info */
.sb-restaurant {
    padding: 14px 20px;
    border-bottom: 1px solid rgba(255,255,255,0.07);
}

.sb-restaurant-name {
    color: #fff;
    font-weight: 600;
    font-size: 13px;
    line-height: 1.4;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.sb-restaurant-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    color: #fbbf24;
    font-size: 12px;
    font-weight: 600;
}

/* Navigation */
.sb-nav { flex: 1; padding: 8px 0; }

.sb-section { margin-bottom: 2px; }

.sb-label {
    padding: 10px 20px 5px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--sidebar-label);
}

.sb-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: all 120ms ease;
    border-left: 3px solid transparent;
}

.sb-link:hover {
    color: var(--sidebar-text-active);
    background: var(--sidebar-hover);
}

.sb-link.active {
    color: var(--sidebar-text-active);
    background: var(--sidebar-active-bg);
    border-left-color: var(--sidebar-active-border);
}

.sb-link svg {
    width: 19px; height: 19px;
    flex-shrink: 0;
    opacity: 0.6;
}

.sb-link:hover svg, .sb-link.active svg { opacity: 1; }

.sb-badge {
    margin-left: auto;
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 10px;
    font-weight: 700;
    line-height: 1.4;
}

.sb-badge-ai {
    background: linear-gradient(135deg, #ec7205, #ff8c42);
    color: #fff;
}

.sb-badge-free {
    background: rgba(16,185,129,0.15);
    color: #10b981;
}

/* Footer */
.sb-footer {
    padding: 14px 16px;
    border-top: 1px solid rgba(255,255,255,0.07);
    margin-top: auto;
}

.sb-sofia {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(236,114,5,0.08);
    border-radius: var(--radius);
    margin-bottom: 10px;
}

.sb-sofia-avatar {
    width: 30px; height: 30px;
    background: linear-gradient(135deg, #ec7205, #ff8c42);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.sb-sofia-text {
    color: rgba(255,255,255,0.7);
    font-size: 11.5px;
    line-height: 1.3;
}

.sb-sofia-text strong {
    color: #fff;
    display: block;
    font-size: 12.5px;
}

.sb-logout {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    color: rgba(255,255,255,0.4);
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    transition: all 120ms ease;
}

.sb-logout:hover {
    color: rgba(255,255,255,0.85);
    background: rgba(255,255,255,0.06);
}

.sb-logout svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ===== CONTENT AREA ===== */
.content-area {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-height: 100vh;
    min-width: 0;
    overflow-x: hidden;
}

.content-body {
    padding: 28px 32px;
    max-width: 1400px;
}

/* ===== MOBILE ===== */
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 99;
    opacity: 0;
    transition: opacity 300ms ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.sidebar-backdrop.active {
    display: block;
    opacity: 1;
}

.mobile-header {
    display: none;
    background: var(--sidebar-bg);
    color: #fff;
    padding: 0 16px;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 90;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.mobile-header-btn {
    background: none;
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    cursor: pointer;
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    transition: background 120ms ease;
    -webkit-tap-highlight-color: transparent;
}

.mobile-header-btn:active { background: rgba(255,255,255,0.15); }

.mobile-header-title {
    font-weight: 700;
    font-size: 15px;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-header-logo {
    width: 28px; height: 28px;
    flex-shrink: 0;
}

/* Sidebar close button (mobile) */
.sb-close-btn {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px; height: 36px;
    background: rgba(255,255,255,0.08);
    border: none;
    border-radius: 50%;
    color: rgba(255,255,255,0.6);
    cursor: pointer;
    align-items: center; justify-content: center;
    transition: all 120ms ease;
    -webkit-tap-highlight-color: transparent;
    z-index: 1;
}

.sb-close-btn:active { background: rgba(255,255,255,0.18); color: #fff; }

@media (max-width: 1024px) {
    .app-shell { flex-direction: column; }
    .sidebar {
        transform: translateX(-100%);
        width: min(300px, 85vw);
        box-shadow: 4px 0 24px rgba(0,0,0,0.3);
    }
    .sidebar.open { transform: translateX(0); }
    .sb-close-btn { display: flex; }
    .content-area { margin-left: 0; width: 100%; }
    .mobile-header { display: flex; }
    .content-body { padding: 16px 14px; }
    .sb-link { padding: 12px 20px; font-size: 14.5px; min-height: 46px; }
    .sb-brand { padding: 20px 20px 16px 20px; padding-right: 52px; }
}

@media (max-width: 480px) {
    .mobile-header { height: 52px; padding: 0 12px; gap: 8px; }
    .mobile-header-title { font-size: 14px; }
    .content-body { padding: 12px 10px; }
    .g-card { padding: 20px 16px; border-radius: var(--radius); margin-bottom: 16px; }
    .g-card-header { gap: 10px; margin-bottom: 16px; }
    .g-card-icon { width: 38px; height: 38px; font-size: 18px; border-radius: 8px; }
    .g-card-title { font-size: 17px; }
    .g-btn { padding: 12px 18px; font-size: 14px; width: 100%; }
}

/* ===== NO SIDEBAR ===== */
.app-shell.no-sidebar .content-area { margin-left: 0; }
.app-shell.no-sidebar .sidebar,
.app-shell.no-sidebar .sidebar-backdrop,
.app-shell.no-sidebar .mobile-header { display: none !important; }

/* ===== COMMON CARD ===== */
.g-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 24px;
}

.g-card-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 24px;
}

.g-card-icon {
    width: 44px; height: 44px;
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    border-radius: var(--radius);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    color: #fff;
    flex-shrink: 0;
}

.g-card-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-1);
}

/* ===== UTILITY ===== */
.g-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

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

@media (max-width: 768px) {
    .g-grid-2, .g-grid-3 { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 480px) {
    .g-grid-2, .g-grid-3 { gap: 10px; }
}

.g-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 150ms ease;
    text-decoration: none;
    font-family: inherit;
}

.g-btn:hover { transform: translateY(-1px); }

.g-btn-primary {
    background: linear-gradient(135deg, var(--brand), var(--brand-light));
    color: #fff;
    box-shadow: 0 4px 14px rgba(236,114,5,0.25);
}

.g-btn-primary:hover { box-shadow: 0 6px 20px rgba(236,114,5,0.35); }

.g-btn-secondary {
    background: #fff;
    color: var(--brand);
    border: 2px solid var(--brand);
}

.g-btn-secondary:hover { background: #fff7ed; }

.g-btn-success {
    background: linear-gradient(135deg, #10b981, #059669);
    color: #fff;
    box-shadow: 0 4px 14px rgba(16,185,129,0.25);
}
