:root {
    --bg-dark: #0f1115;
    --surface-dark: #1a1c23;
    --surface-light: #242731;
    --primary: #ff6b6b;
    --primary-hover: #ff5252;
    --accent: #4ecdc4;
    --text-main: #f8f9fa;
    --text-muted: #adb5bd;
    --border: rgba(255, 255, 255, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    --radius: 16px;
    --radius-sm: 10px;
    --transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', sans-serif;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Header */
.top-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: rgba(26, 28, 35, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.nav-icon {
    font-size: 1.8rem;
    color: var(--primary);
    background: rgba(255, 107, 107, 0.1);
    padding: 0.5rem;
    border-radius: 12px;
}

.nav-title h1 {
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.nav-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-family: monospace;
}

.status-badge {
    background: rgba(78, 205, 196, 0.15);
    color: var(--accent);
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid rgba(78, 205, 196, 0.3);
}

.status-badge.pulse::before {
    content: '';
    width: 8px;
    height: 8px;
    background-color: var(--accent);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(78, 205, 196, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(78, 205, 196, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(78, 205, 196, 0); }
}

/* Main Content */
.content {
    flex: 1;
    padding: 1.5rem;
    overflow-y: auto;
}

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

/* Order Card */
.order-card {
    background: var(--surface-dark);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    animation: slideUp 0.4s ease forwards;
}

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

.order-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow);
    border-color: rgba(255, 255, 255, 0.15);
}

.order-card.new-order::after {
    content: 'NEW';
    position: absolute;
    top: 12px;
    right: -24px;
    background: var(--primary);
    color: white;
    font-size: 0.7rem;
    font-weight: 800;
    padding: 0.2rem 2rem;
    transform: rotate(45deg);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

.table-badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.3rem 0.8rem;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-main);
}

.time-elapsed {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.time-elapsed.warning { color: #feca57; }
.time-elapsed.danger { color: var(--primary); font-weight: 600; }

.customer-info {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.customer-info span {
    color: var(--text-main);
    font-weight: 600;
}

.items-preview {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.card-footer {
    display: flex;
    justify-content: flex-end;
}

.btn-view {
    background: rgba(255, 255, 255, 0.05);
    border: none;
    color: var(--accent);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-view:hover {
    background: rgba(78, 205, 196, 0.1);
}

/* Modals */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: var(--surface-dark);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
    transform: scale(0.95);
    transition: var(--transition);
    border: 1px solid var(--border);
}

.modal-content.modal-sm {
    max-width: 400px;
}

.modal-overlay.active .modal-content {
    transform: scale(1);
}

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

.modal-header h2 {
    font-size: 1.4rem;
}

.modal-subtitle {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

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

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

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
}

/* Order Items */
.order-items-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.order-item {
    background: var(--surface-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.order-item:hover {
    border-color: var(--accent);
    transform: translateX(5px);
}

.item-qty {
    background: var(--bg-dark);
    color: var(--accent);
    font-weight: 700;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.item-details {
    flex: 1;
}

.item-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.item-modifiers {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.modifier-tag {
    display: inline-block;
    background: rgba(255,255,255,0.05);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    margin-right: 0.3rem;
    margin-bottom: 0.3rem;
    border: 1px solid rgba(255,255,255,0.1);
}

.item-action {
    color: var(--text-muted);
    font-size: 1.2rem;
    align-self: center;
}

/* Ingredients List */
.ingredients-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ingredient-item {
    display: flex;
    justify-content: space-between;
    padding: 0.8rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
    border-left: 3px solid var(--accent);
}

.ing-name { font-weight: 500; }
.ing-qty { color: var(--accent); font-weight: 700; }

.modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border);
}

.btn {
    padding: 1rem 1.5rem;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
}

.btn-block {
    width: 100%;
}

.empty-state {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 400px;
    color: var(--text-muted);
    text-align: center;
}

.empty-state i {
    font-size: 4rem;
    color: rgba(255,255,255,0.1);
    margin-bottom: 1rem;
}

/* ═══════════════════════════════════════════════════════════
   LOGIN SCREEN
═══════════════════════════════════════════════════════════ */
.login-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: radial-gradient(ellipse at 60% 40%, #1f2235 0%, #0a0c12 70%);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.login-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.login-card {
    background: rgba(26, 28, 35, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 2.5rem 2rem;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 32px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255,107,107,0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    animation: loginFadeIn 0.5s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

@keyframes loginFadeIn {
    from { opacity: 0; transform: translateY(30px) scale(0.97); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #fff;
    margin: 0 auto 1.5rem;
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.35);
    animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {
    0%, 100% { box-shadow: 0 8px 24px rgba(255, 107, 107, 0.35); }
    50%       { box-shadow: 0 12px 32px rgba(255, 107, 107, 0.55); }
}

.login-title {
    text-align: center;
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin-bottom: 0.3rem;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.login-field {
    margin-bottom: 1.2rem;
}

.login-field label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.login-field input {
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 0.85rem 1rem;
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition);
    outline: none;
    font-family: 'Inter', sans-serif;
}

.login-field input:focus {
    border-color: var(--primary);
    background: rgba(255, 107, 107, 0.05);
    box-shadow: 0 0 0 3px rgba(255, 107, 107, 0.15);
}

.login-field input::placeholder {
    color: rgba(255,255,255,0.25);
}

/* Password wrapper */
.pw-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.pw-wrap input {
    padding-right: 3rem;
}

.pw-toggle {
    position: absolute;
    right: 0.75rem;
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 0.3rem;
    transition: color 0.2s;
    line-height: 1;
}

.pw-toggle:hover {
    color: var(--primary);
}

/* Error message */
.login-error {
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    min-height: 1.2rem;
    margin-bottom: 0.5rem;
    text-align: center;
    opacity: 0;
    transition: opacity 0.3s;
}

.login-error.show {
    opacity: 1;
}

/* Login button */
.btn-login {
    width: 100%;
    padding: 0.95rem;
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
    font-family: 'Inter', sans-serif;
    box-shadow: 0 4px 16px rgba(255, 107, 107, 0.3);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(255, 107, 107, 0.45);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Spinner */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.spin {
    display: inline-block;
    animation: spin 0.7s linear infinite;
}

/* ── Logged-in user info & logout button in header ── */
.user-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    padding: 0.4rem 0.9rem;
    border-radius: 20px;
    border: 1px solid var(--border);
}

.user-info i {
    color: var(--accent);
    font-size: 1.1rem;
}

.btn-logout {
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.25);
    color: var(--primary);
    font-size: 1.2rem;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(255, 107, 107, 0.25);
    transform: rotate(-10deg);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* ═══════════════════════════════════════════════════════════
   BRANCH SELECTION
═══════════════════════════════════════════════════════════ */
.branch-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    max-height: 320px;
    overflow-y: auto;
}

.branch-loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.branch-item {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    padding: 1rem 1.25rem;
    color: var(--text-main);
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    transition: var(--transition);
}

.branch-item i {
    font-size: 1.3rem;
    color: var(--accent);
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: rgba(78, 205, 196, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.branch-item:hover {
    background: rgba(78, 205, 196, 0.08);
    border-color: rgba(78, 205, 196, 0.4);
    transform: translateX(4px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* Branch badge in header */
.branch-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--accent);
    background: rgba(78, 205, 196, 0.1);
    padding: 0.4rem 0.75rem 0.4rem 0.9rem;
    border-radius: 20px;
    border: 1px solid rgba(78, 205, 196, 0.3);
}

.branch-badge i {
    font-size: 1rem;
    flex-shrink: 0;
}

.btn-change-branch {
    background: rgba(78, 205, 196, 0.15);
    border: none;
    color: var(--accent);
    font-size: 0.9rem;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    margin-left: 0.2rem;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-change-branch:hover {
    background: rgba(78, 205, 196, 0.3);
    transform: rotate(180deg);
}

