/* C:\xampp\htdocs\StudySyn\assets\css\style.css */

/* --- 1. DESIGN SYSTEM & CUSTOM PROPERTIES --- */
:root {
    --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* Sleek, Modern HSL Color Palette */
    --primary-h: 220;
    --primary-s: 75%;
    --primary-l: 50%;
    
    --primary: hsl(var(--primary-h), var(--primary-s), var(--primary-l));
    --primary-hover: hsl(var(--primary-h), var(--primary-s), calc(var(--primary-l) - 8%));
    --primary-light: hsl(var(--primary-h), var(--primary-s), 95%);
    
    --bg-app: #f6f8fa;
    --bg-surface: #ffffff;
    --bg-surface-elevated: #ffffff;
    
    --border-color: #e5e7eb;
    --border-focus: hsl(var(--primary-h), var(--primary-s), 70%);
    
    /* Text Colors */
    --text-primary: #1f2937;
    --text-secondary: #4b5563;
    --text-muted: #9ca3af;
    --text-on-primary: #ffffff;
    
    /* Semantic Colors */
    --success: #10b981;
    --success-light: #ecfdf5;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --purple: #8b5cf6;
    --purple-light: #f5f3ff;
    
    /* Depth & Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.02);
    
    /* Border Radii */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    
    /* Container Widths */
    --container-max-width: 1280px;
    --header-height: 72px;
}

/* Dark Mode Colors (Optional styling variables if toggled, we build a high-contrast premium clean theme) */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-app: #0f172a;
        --bg-surface: #1e293b;
        --bg-surface-elevated: #334155;
        --border-color: #334155;
        --text-primary: #f8fafc;
        --text-secondary: #cbd5e1;
        --text-muted: #64748b;
        --primary-light: rgba(59, 130, 246, 0.15);
    }
}

/* --- 2. BASE RESET & ACCESSIBILITY --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-app);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
}

/* Touch Friendly Elements */
button, input, select, textarea {
    font-family: inherit;
    font-size: 1rem;
    color: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

/* Focus States */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* --- 3. LAYOUT STRUCTURE --- */
.app-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header & Navigation */
.main-header {
    background-color: var(--bg-surface);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
}

.header-content {
    max-width: var(--container-max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo-section a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 800;
    font-size: 1.25rem;
    letter-spacing: -0.025em;
    color: var(--primary);
}

.logo-icon {
    font-size: 1.5rem;
}

.nav-links {
    display: flex;
    gap: 1rem;
    height: 100%;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    font-weight: 500;
    font-size: 0.95rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: var(--primary);
}

.nav-link.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

.user-section {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.user-info {
    text-align: right;
    display: flex;
    flex-direction: column;
}

.user-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Main Content Area */
.main-content {
    flex: 1;
    max-width: var(--container-max-width);
    width: 100%;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

/* Footer styling */
.main-footer {
    background-color: var(--bg-surface);
    border-top: 1px solid var(--border-color);
    padding: 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* --- 4. COMPONENTS --- */

/* Alert Notifications */
.alert {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: fadeIn 0.3s ease;
}

.alert-success {
    background-color: var(--success-light);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.alert-error {
    background-color: var(--danger-light);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.badge-role-admin { background-color: var(--purple-light); color: var(--purple); }
.badge-role-staff { background-color: var(--info-light); color: var(--info); }

/* Table Status Badges */
.badge-table-free { background-color: var(--success-light); color: var(--success); }
.badge-table-occupied { background-color: var(--danger-light); color: var(--danger); }
.badge-table-reserved { background-color: var(--warning-light); color: var(--warning); }

/* Order Status Badges */
.badge-order-pending { background-color: #f3f4f6; color: #4b5563; }
.badge-order-preparing { background-color: var(--info-light); color: var(--info); }
.badge-order-ready { background-color: var(--purple-light); color: var(--purple); }
.badge-order-served { background-color: #fef3c7; color: #d97706; }
.badge-order-completed { background-color: var(--success-light); color: var(--success); }
.badge-order-cancelled { background-color: var(--danger-light); color: var(--danger); }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    min-height: 44px; /* Touch target */
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--text-on-primary);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
}

.btn-secondary {
    background-color: var(--bg-app);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover {
    background-color: var(--border-color);
}

.btn-danger {
    background-color: var(--danger-light);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.1);
}

.btn-danger:hover {
    background-color: var(--danger);
    color: var(--text-on-primary);
}

.btn-sm {
    padding: 0.5rem 0.875rem;
    min-height: 36px;
    font-size: 0.85rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    min-height: 44px;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-light);
    outline: none;
}

/* Cards */
.card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    box-shadow: var(--shadow-md);
}

.card-title {
    font-size: 1.15rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

/* --- 5. PAGES & VIEWS --- */

/* Login Page specific */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1.5rem;
    background: radial-gradient(circle at top right, var(--primary-light), var(--bg-app));
}

.auth-card {
    max-width: 440px;
    width: 100%;
    background-color: var(--bg-surface);
    padding: 2.5rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-xl);
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-logo {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.auth-title {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.auth-subtitle {
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Dashboard view */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    background-color: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
}

.stat-info {
    flex: 1;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-size: 1.85rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

/* Tables Floor Plan Grid */
.tables-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem;
}

.table-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.table-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.table-card.status-free { border-top: 5px solid var(--success); }
.table-card.status-occupied { border-top: 5px solid var(--danger); }
.table-card.status-reserved { border-top: 5px solid var(--warning); }

.table-icon {
    font-size: 2.5rem;
    margin: 0.5rem 0;
}

.table-name {
    font-weight: 700;
    font-size: 1.15rem;
}

.table-capacity {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Order Board / KDS View */
.orders-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 1.5rem;
}

.order-ticket {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
}

.order-ticket-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 1px dashed var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
}

.order-id {
    font-weight: 700;
    font-size: 1.1rem;
}

.order-time {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.order-items-list {
    list-style: none;
    margin-bottom: 1rem;
}

.order-item-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.95rem;
    margin-bottom: 0.4rem;
}

.order-item-qty {
    font-weight: 700;
    color: var(--primary);
    margin-right: 0.5rem;
}

.order-item-notes {
    font-size: 0.8rem;
    color: var(--warning);
    margin-left: 1.5rem;
    font-style: italic;
}

.order-ticket-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--border-color);
    padding-top: 0.75rem;
    margin-top: 0.75rem;
}

.order-total {
    font-weight: 800;
    font-size: 1.15rem;
}

/* Menu Order Taking Page layout */
.menu-order-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 2rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .menu-order-layout {
        grid-template-columns: 1fr;
    }
}

.menu-categories-bar {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    margin-bottom: 1.5rem;
    scrollbar-width: thin;
}

.category-tab {
    padding: 0.5rem 1.25rem;
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.category-tab.active {
    background-color: var(--primary);
    color: var(--text-on-primary);
    border-color: var(--primary);
}

.menu-items-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}

.menu-item-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: all 0.2s;
}

.menu-item-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.menu-item-img {
    height: 140px;
    background-color: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    position: relative;
}

.menu-item-info {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.menu-item-name {
    font-weight: 700;
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.menu-item-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    flex: 1;
}

.menu-item-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.menu-item-price {
    font-weight: 800;
    color: var(--text-primary);
}

/* Cart Panel details */
.cart-panel {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    position: sticky;
    top: 96px;
    box-shadow: var(--shadow-md);
}

.cart-items {
    max-height: 320px;
    overflow-y: auto;
    margin: 1rem 0;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.cart-item-details {
    flex: 1;
}

.cart-item-name {
    font-weight: 600;
    font-size: 0.9rem;
}

.cart-item-price {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.cart-item-qty-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background-color: var(--bg-app);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    cursor: pointer;
}

.cart-total-section {
    border-top: 2px solid var(--border-color);
    padding-top: 1rem;
    margin-top: 1rem;
}

.cart-total-row {
    display: flex;
    justify-content: space-between;
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 1rem;
}

/* Responsive Overrides */
@media (max-width: 768px) {
    .main-header {
        height: auto;
        padding: 0.75rem 0;
    }
    .header-content {
        flex-direction: column;
        gap: 0.75rem;
        padding: 0 1rem;
    }
    .nav-links {
        width: 100%;
        justify-content: center;
        gap: 0.5rem;
    }
    .nav-link {
        padding: 0.5rem;
        font-size: 0.85rem;
    }
    .user-section {
        display: none; /* Hide profile summary on small mobiles to save room */
    }
    .main-content {
        padding: 1.25rem 1rem;
    }
}

/* Modern Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* Simple Responsive Table Design (Standard Tables inside lists) */
.table-responsive {
    overflow-x: auto;
    width: 100%;
    margin-bottom: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th, .data-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: var(--bg-app);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.data-table tr:hover td {
    background-color: rgba(243, 244, 246, 0.3);
}
