/* =========================================
   GastroSync | SaaS Restaurant System
   Premium Dark Theme CSS
========================================= */

:root {
    /* Colors */
    --bg-base: #0f172a;
    --bg-surface: rgba(30, 41, 59, 0.7);
    --bg-surface-hover: rgba(51, 65, 85, 0.8);
    
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.2);
    
    --accent-available: #10b981; /* Emerald */
    --accent-available-light: rgba(16, 185, 129, 0.15);
    
    --accent-reserved: #f43f5e; /* Rose */
    --accent-reserved-light: rgba(244, 63, 94, 0.15);
    
    --accent-pending: #eab308; /* Yellow */
    --accent-occupied: #8b5cf6; /* Purple */
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --border-color: rgba(255, 255, 255, 0.1);
    
    /* Effects */
    --glass-blur: blur(16px);
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.15);
    --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.4);
    
    /* Layout */
    --border-radius-lg: 16px;
    --border-radius-md: 12px;
    --border-radius-sm: 8px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   Reset & Base
========================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

/* Abstract Background Shapes for Premium feel */
.bg-shape {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.5;
}

.shape-1 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--primary-light), transparent 70%);
    top: -100px;
    left: -100px;
}

.shape-2 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-reserved-light), transparent 70%);
    bottom: -200px;
    right: -100px;
}

.shape-3 {
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--accent-available-light), transparent 70%);
    top: 40%;
    left: 40%;
}

/* Typography */
h1, h2, h3, h4 { font-weight: 600; line-height: 1.2; }
p { line-height: 1.5; color: var(--text-muted); }

/* Utility Classes */
.hidden { display: none !important; }
.mt-4 { margin-top: 1.5rem; }
.mb-2 { margin-bottom: 0.75rem; }
.w-100 { width: 100%; }

.glass {
    background: var(--bg-surface);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
}

.fade-in { animation: fadeIn 0.4s ease-out forwards; }
.fade-in-up { animation: fadeInUp 0.4s ease-out forwards; }

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* =========================================
   Navbar
========================================= */
.navbar {
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.logo-icon {
    color: var(--primary);
    font-size: 1.75rem;
}

.logo span { color: var(--primary); }

.role-switcher {
    display: flex;
    background: rgba(0,0,0,0.2);
    border-radius: 30px;
    padding: 4px;
    border: 1px solid var(--border-color);
}

.role-switcher button {
    background: transparent;
    border: none;
    color: var(--text-muted);
    padding: 0.5rem 1.25rem;
    border-radius: 26px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 500;
    font-size: 0.9rem;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.role-switcher button:hover { color: var(--text-main); }

.role-switcher button.active {
    background: var(--primary);
    color: white;
    box-shadow: var(--shadow-sm);
}

.user-profile {
    position: relative;
    display: flex;
    align-items: center;
}

.avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid var(--primary);
}

.notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 12px;
    height: 12px;
    background: var(--accent-reserved);
    border-radius: 50%;
    border: 2px solid var(--bg-base);
}

/* =========================================
   Layout & Container
========================================= */
#app-container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 2rem;
}

/* Client View Layout */
#view-client {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 2rem;
    align-items: start;
}

/* Manager View Layout */
.manager-dashboard {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.manager-workspace {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 2rem;
}

/* Responsive */
@media (max-width: 1200px) {
    #view-client { grid-template-columns: 1fr; }
    .manager-workspace { grid-template-columns: 1fr; }
}

/* =========================================
   Floor Plan System
========================================= */
.floor-plan-container {
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    height: 80vh;
}

.floor-plan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.legend, .manager-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
}

.manager-legend {
    margin-top: 1rem;
    justify-content: center;
}

.manager-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.manager-controls input, .manager-controls select {
    width: auto;
    padding: 0.5rem 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.dot.available { background: var(--accent-available); box-shadow: 0 0 8px var(--accent-available); }
.dot.reserved { background: var(--accent-reserved); box-shadow: 0 0 8px var(--accent-reserved); }
.dot.selected { background: var(--primary); box-shadow: 0 0 8px var(--primary); }
.dot.occupied { background: var(--accent-occupied); }

.client-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: var(--border-radius-md);
}

.guest-group {
    width: 100%;
}

.guest-tiles {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.guest-tile {
    padding: 0.5rem 1rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    color: var(--text-main);
    cursor: pointer;
    font-family: inherit;
    transition: var(--transition);
}

.guest-tile:hover {
    background: rgba(255,255,255,0.1);
}

.guest-tile.active {
    background: var(--primary);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

.floor-plan-wrapper {
    flex-grow: 1;
    min-height: 50vh;
    position: relative;
    background: rgba(15, 23, 42, 0.4);
    border-radius: var(--border-radius-md);
    border: 1px dashed var(--border-color);
    overflow: hidden;
}

.hidden-section {
    display: none !important;
}

.floor-plan {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

/* The Tables */
.table-element {
    position: absolute;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border: 2px solid transparent;
    cursor: pointer;
    transition: var(--transition);
    color: white;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    z-index: 10;
}

.table-element:hover {
    transform: scale(1.05) translateY(-2px);
    z-index: 20;
}

.table-rect { border-radius: 8px; }
.table-circle { border-radius: 50%; }

.table-number { font-size: 1.2rem; }
.table-seats { font-size: 0.7rem; font-weight: 400; opacity: 0.8; }

/* Table Statuses */
.status-available {
    background: var(--bg-surface);
    border-color: var(--accent-available);
}
.status-available:hover {
    box-shadow: 0 0 15px var(--accent-available-light);
    background: rgba(16, 185, 129, 0.2);
}

.status-reserved {
    background: var(--bg-surface);
    border-color: var(--accent-reserved);
    opacity: 0.7;
    cursor: not-allowed;
}

.status-selected {
    background: var(--primary);
    border-color: var(--primary-hover);
    box-shadow: var(--shadow-glow);
    transform: scale(1.05);
}

.status-occupied {
    background: var(--accent-occupied);
    border-color: #7c3aed;
}

.status-too-small {
    background: rgba(0,0,0,0.2);
    border-color: rgba(255,255,255,0.05);
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(100%);
}

/* =========================================
   Sidebar & Forms
========================================= */
.sidebar {
    border-radius: var(--border-radius-lg);
    padding: 2rem;
    height: 80vh;
    overflow-y: auto;
}

.sidebar-empty, .sidebar-success {
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 1rem;
    color: var(--text-muted);
}

.empty-icon { font-size: 3rem; opacity: 0.5; }
.success-icon { font-size: 4rem; color: var(--accent-available); }

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.badge {
    background: var(--primary-light);
    color: #a5b4fc;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
}
.badge.yellow { background: rgba(234, 179, 8, 0.2); color: var(--accent-pending); }

.table-details {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: var(--border-radius-md);
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Form Styles */
.form-group {
    margin-bottom: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

input, select {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-size: 1rem;
    transition: var(--transition);
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

/* Color input icons in dark mode */
::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.7;
    cursor: pointer;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-action {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-radius: var(--border-radius-sm);
    font-family: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: rgba(255,255,255,0.1);
    color: white;
}
.btn-secondary:hover {
    background: rgba(255,255,255,0.15);
}

.btn-outline-success {
    background: transparent;
    border: 1px solid var(--accent-available);
    color: var(--accent-available);
}
.btn-outline-success:hover { background: var(--accent-available-light); }

.btn-outline-danger {
    background: transparent;
    border: 1px solid var(--accent-occupied);
    color: var(--accent-occupied);
}
.btn-outline-danger:hover { background: rgba(139, 92, 246, 0.15); }

.btn-icon {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    transition: var(--transition);
}
.btn-icon:hover { color: white; }

/* Alerts */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
}
.alert.error { background: var(--accent-reserved-light); border: 1px solid var(--accent-reserved); color: #fda4af; }

/* =========================================
   Manager View Details
========================================= */
.stats-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.card {
    padding: 1.5rem;
    border-radius: var(--border-radius-lg);
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.card-icon {
    width: 60px;
    height: 60px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
}

.icon-blue { background: var(--primary-light); color: var(--primary); }
.icon-yellow { background: rgba(234, 179, 8, 0.2); color: var(--accent-pending); }
.icon-green { background: var(--accent-available-light); color: var(--accent-available); }

.card-label { font-size: 0.9rem; margin-bottom: 0.25rem; }
.card-value { font-size: 2rem; }

.reservations-panel {
    border-radius: var(--border-radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    max-height: 50vh;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}
.panel-header h2 { font-size: 1.1rem; display: flex; align-items: center; gap: 0.5rem; }

.list-container {
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding-right: 0.5rem;
}

.list-container::-webkit-scrollbar, .sidebar::-webkit-scrollbar {
    width: 6px;
}
.list-container::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

/* Reservation Item */
.res-item {
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    transition: var(--transition);
}
.res-item:hover { background: rgba(0,0,0,0.3); border-color: rgba(255,255,255,0.2); }

.res-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.res-name { font-weight: 600; font-size: 1.05rem; }
.res-time { color: var(--primary); font-weight: 500; font-size: 0.9rem; }

.res-details {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.res-details span { display: flex; align-items: center; gap: 0.3rem; }

.res-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.btn-small {
    padding: 0.4rem 0.75rem;
    font-size: 0.8rem;
    border-radius: 4px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}
.btn-approve { background: var(--accent-available-light); color: var(--accent-available); }
.btn-approve:hover { background: var(--accent-available); color: white; }
.btn-reject { background: var(--accent-reserved-light); color: var(--accent-reserved); }
.btn-reject:hover { background: var(--accent-reserved); color: white; }

/* Mini List for Modal */
.mini-res-list { list-style: none; }
.mini-res-list li {
    padding: 0.75rem;
    background: rgba(0,0,0,0.2);
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
}

/* =========================================
   Modal
========================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal {
    width: 90%;
    max-width: 500px;
    padding: 2rem;
    border-radius: var(--border-radius-lg);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
}
.modal-subtitle { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; }

.current-status-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 1rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 1.5rem;
}

.status-badge {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9rem;
}
.badge-wolny { background: var(--accent-available-light); color: var(--accent-available); }
.badge-zajety { background: rgba(139, 92, 246, 0.2); color: var(--accent-occupied); }

.status-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* =========================================
   Mobile Responsiveness
========================================= */
@media (max-width: 768px) {
    /* Navbar */
    .navbar {
        flex-direction: column;
        height: auto;
        padding: 1rem;
        gap: 1rem;
    }
    
    .user-profile {
        position: absolute;
        top: 1rem;
        right: 1rem;
    }
    
    /* Layout */
    #app-container {
        padding: 1rem;
    }
    
    .floor-plan-container {
        height: auto;
        min-height: 0;
        padding: 1rem;
    }
    
    /* Headers & Controls */
    .floor-plan-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .manager-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .manager-controls input, .manager-controls select {
        flex: 1;
        width: 100%; /* overrides width: auto */
    }
    
    .client-filters {
        flex-direction: column;
        gap: 1rem;
    }
    
    /* Legend */
    .legend, .manager-legend {
        flex-wrap: wrap;
        justify-content: flex-start;
        gap: 0.5rem;
    }
    
    .manager-legend {
        justify-content: center;
    }
    
    /* Floor Plan Tables - List View on Mobile */
    .floor-plan {
        position: static !important;
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 0.75rem;
        padding-right: 0.5rem;
    }
    
    .floor-plan-wrapper {
        border: none;
        background: transparent;
        overflow-y: auto;
    }

    .table-element {
        position: static !important;
        width: 100% !important;
        height: 80px !important;
        border-radius: var(--border-radius-sm) !important;
        transform: none !important;
    }
    
    .table-number {
        font-size: 1.1rem;
    }
    
    .table-seats {
        font-size: 0.8rem;
    }
    
    /* Sidebar */
    .sidebar {
        height: auto;
        overflow: visible;
        padding: 1.5rem;
    }
    
    /* Modals & Manager specific */
    .status-actions {
        grid-template-columns: 1fr;
    }
    
    .manager-dashboard {
        gap: 1rem;
    }
    
    .manager-workspace {
        gap: 1rem;
    }
    
    .reservations-panel {
        max-height: none;
    }
}

