/* ============================================
   Kedai Kota Toea - Vintage Theme CSS
   Shared across all POS endpoints
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400&family=Montserrat:wght@300;400;500;600;700;800&display=swap');

:root {
    --earth-brown: #8B5A2B;
    --earth-brown-light: #A67C52;
    --earth-brown-dark: #5D3A1E;
    --forest-green: #2F4F4F;
    --forest-green-light: #3D6B6B;
    --cream: #F5F5DC;
    --cream-dark: #E8E4CE;
    --vintage-paper: #FDFBF3;
    --burnt-orange: #CC6633;
    --terracotta: #C04000;
    --text-dark: #2C1810;
    --text-muted: #6B5B4E;
    --text-light: #9C8B7E;
    --white: #FFFFFF;
    --success: #2E7D32;
    --danger: #C62828;
    --warning: #E65100;
    --info: #1565C0;
    --shadow-sm: 0 2px 8px rgba(44, 24, 16, 0.08);
    --shadow-md: 0 4px 20px rgba(44, 24, 16, 0.12);
    --shadow-lg: 0 8px 40px rgba(44, 24, 16, 0.16);
    --shadow-retro: 4px 4px 0px rgba(44, 24, 16, 0.15);
    --border-classic: 2px solid var(--earth-brown);
    --radius-sm: 8px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--cream);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* Paper texture overlay */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: 
        url("data:image/svg+xml,%3Csvg width='100' height='100' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100' height='100' filter='url(%23n)' opacity='0.03'/%3E%3C/svg%3E") repeat;
    pointer-events: none;
    z-index: 0;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Playfair Display', serif;
    color: var(--earth-brown-dark);
    line-height: 1.3;
}

h1 { font-size: 2.5rem; font-weight: 800; }
h2 { font-size: 1.8rem; font-weight: 700; }
h3 { font-size: 1.4rem; font-weight: 600; }

p { color: var(--text-muted); }

a {
    color: var(--forest-green);
    text-decoration: none;
    transition: var(--transition);
}
a:hover { color: var(--earth-brown); }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    box-shadow: var(--shadow-retro);
}
.btn:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0px rgba(44, 24, 16, 0.15); }

.btn-primary {
    background: var(--forest-green);
    color: var(--white);
}
.btn-primary:hover { background: var(--forest-green-light); transform: translateY(-2px); box-shadow: 4px 6px 0px rgba(44, 24, 16, 0.18); }

.btn-brown {
    background: var(--earth-brown);
    color: var(--white);
}
.btn-brown:hover { background: var(--earth-brown-light); }

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

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

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

.btn-outline {
    background: transparent;
    color: var(--earth-brown);
    border: 2px solid var(--earth-brown);
    box-shadow: none;
}
.btn-outline:hover { background: var(--earth-brown); color: var(--white); }

.btn-sm { padding: 8px 16px; font-size: 12px; }
.btn-lg { padding: 16px 32px; font-size: 16px; }
.btn-block { width: 100%; }

/* ============ CARDS ============ */
.card {
    background: var(--white);
    border-radius: var(--radius-md);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(139, 90, 43, 0.08);
    position: relative;
    z-index: 1;
}

.card-vintage {
    border: 3px double var(--earth-brown-light);
    background: var(--vintage-paper);
}

/* ============ FORMS ============ */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-weight: 700;
    font-size: 13px;
    color: var(--earth-brown-dark);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--cream-dark);
    border-radius: var(--radius-sm);
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-dark);
    background: var(--vintage-paper);
    transition: var(--transition);
}
.form-control:focus {
    outline: none;
    border-color: var(--earth-brown);
    box-shadow: 0 0 0 3px rgba(139, 90, 43, 0.15);
    background: var(--white);
}
.form-control::placeholder { color: var(--text-light); }

select.form-control { cursor: pointer; }

/* ============ TABLES ============ */
.table-vintage {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.table-vintage thead { background: var(--cream-dark); }
.table-vintage th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--earth-brown-dark);
    border-bottom: 2px solid var(--earth-brown-light);
}
.table-vintage td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--cream-dark);
    vertical-align: middle;
}
.table-vintage tbody tr:hover { background: rgba(245, 245, 220, 0.5); }

/* ============ BADGES ============ */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-pending { background: #FFF3E0; color: #E65100; }
.badge-confirmed { background: #E3F2FD; color: #1565C0; }
.badge-cooking { background: #FFF8E1; color: #FF6F00; }
.badge-ready { background: #E8F5E9; color: #2E7D32; }
.badge-served { background: #F3E5F5; color: #7B1FA2; }
.badge-completed { background: #E8F5E9; color: #1B5E20; }
.badge-cancelled { background: #FFEBEE; color: #B71C1C; }
.badge-paid { background: #E8F5E9; color: #2E7D32; }
.badge-unpaid { background: #FFEBEE; color: #C62828; }

/* ============ STAFF LOGIN PAGE ============ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, var(--cream) 0%, var(--cream-dark) 100%);
}

.login-box {
    background: var(--white);
    border: 3px double var(--earth-brown-light);
    border-radius: var(--radius-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-logo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: contain;
    border: 3px solid var(--earth-brown);
    padding: 5px;
    background: var(--white);
    margin-bottom: 20px;
}

/* ============ DASHBOARD LAYOUT ============ */
.dashboard {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--white);
    border-right: 2px solid var(--cream-dark);
    padding: 24px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    z-index: 10;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 24px;
    margin-bottom: 16px;
    border-bottom: 2px double var(--cream-dark);
}

.sidebar-brand img {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--earth-brown);
    object-fit: contain;
}

.sidebar-brand h3 {
    font-size: 16px;
    color: var(--earth-brown-dark);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 14px;
    transition: var(--transition);
    margin-bottom: 4px;
}
.nav-item:hover { background: var(--cream); color: var(--earth-brown); }
.nav-item.active {
    background: linear-gradient(135deg, var(--earth-brown), var(--earth-brown-light));
    color: var(--white);
    box-shadow: var(--shadow-sm);
}
.nav-item i { width: 20px; text-align: center; font-size: 16px; }

.main-content {
    padding: 30px;
    overflow-y: auto;
    position: relative;
    z-index: 1;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

/* ============ STATS GRID ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--cream-dark);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.stat-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    font-size: 22px;
}
.stat-icon.brown { background: rgba(139, 90, 43, 0.1); color: var(--earth-brown); }
.stat-icon.green { background: rgba(47, 79, 79, 0.1); color: var(--forest-green); }
.stat-icon.orange { background: rgba(204, 102, 51, 0.08); color: var(--burnt-orange); }
.stat-icon.red { background: rgba(198, 40, 40, 0.08); color: var(--danger); }

.stat-value { font-size: 24px; font-weight: 800; color: var(--text-dark); font-family: 'Playfair Display', serif; }
.stat-label { font-size: 12px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }

/* ============ TOAST ============ */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: 14px;
    color: var(--white);
    background: var(--forest-green);
    box-shadow: var(--shadow-md);
    animation: toastIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    gap: 10px;
}
.toast.error { background: var(--danger); }
.toast.warning { background: var(--warning); }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ============ MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(44, 24, 16, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-overlay.active { display: flex; }

.modal {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 32px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    border: 2px solid var(--cream-dark);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px double var(--cream-dark);
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: var(--cream);
    border-radius: 50%;
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 18px;
    color: var(--text-muted);
    transition: var(--transition);
}
.modal-close:hover { background: var(--danger); color: var(--white); }

/* ============ LOADING ============ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(253, 251, 243, 0.95);
    z-index: 10001;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 16px;
}
.loading-overlay.active { display: flex; }

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--cream-dark);
    border-top-color: var(--earth-brown);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ UTILITY ============ */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-brown { color: var(--earth-brown); }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.d-flex { display: flex; }
.flex-wrap { flex-wrap: wrap; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-100 { width: 100%; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--cream); }
::-webkit-scrollbar-thumb { background: var(--earth-brown-light); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--earth-brown); }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .dashboard { grid-template-columns: 1fr; }
    .sidebar { 
        position: fixed; 
        left: -280px; 
        top: 0; 
        width: 260px;
        z-index: 100; 
        transition: var(--transition);
        box-shadow: none;
    }
    .sidebar.open { left: 0; box-shadow: var(--shadow-lg); }
    .main-content { padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 14px; }
    h1 { font-size: 1.8rem; }
    h2 { font-size: 1.4rem; }
    .modal { padding: 20px; margin: 10px; }
    .page-header { flex-direction: column; gap: 12px; align-items: stretch; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
}

/* ============ ANIMATION CLASSES ============ */
.fade-in { animation: fadeIn 0.5s ease forwards; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.slide-up { animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }

/* ============ VINTAGE DECORATIVE ELEMENTS ============ */
.divider {
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--earth-brown-light), transparent);
    margin: 24px 0;
}

.ornament {
    text-align: center;
    color: var(--earth-brown-light);
    font-size: 20px;
    letter-spacing: 8px;
    margin: 16px 0;
}

.classic-border {
    border: 3px double var(--earth-brown-light);
    padding: 4px;
}

.classic-border-inner {
    border: 1px solid var(--earth-brown-light);
    padding: 16px;
}

/* ============ EMPTY STATE ============ */
.empty-state {
    text-align: center;
    padding: 60px 24px;
    color: var(--text-light);
}
.empty-state i { font-size: 48px; margin-bottom: 16px; opacity: 0.4; }
.empty-state p { font-size: 16px; font-weight: 600; }
