/* =============================================
   CafePos - Main Stylesheet
   ============================================= */

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

:root {
  --cream: #fdf6ee;
  --warm-white: #fff9f3;
  --brown-dark: #2c1a0e;
  --brown-mid: #6b3f1f;
  --brown-light: #c4813a;
  --accent: #e8a24a;
  --accent-light: #f5d9a8;
  --text-muted: #9a7b5e;
  --border: #e8d5bc;
  --shadow: rgba(44, 26, 14, 0.1);
  --sidebar-width: 240px;
  --topbar-height: 64px;
  --success: #16a34a;
  --error: #b91c1c;
}

body { font-family: 'DM Sans', sans-serif; background: var(--cream); color: var(--brown-dark); }

/* ---- LOGIN PAGE ---- */
body.login-page {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}

.bg-decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.bg-dots { position: absolute; inset: 0; background-image: radial-gradient(circle, var(--brown-mid) 1px, transparent 1px); background-size: 28px 28px; opacity: 0.06; }
.bg-circle { position: absolute; border-radius: 50%; opacity: 0.07; }
.bg-circle-1 { width: 600px; height: 600px; background: var(--brown-light); top: -200px; right: -150px; }
.bg-circle-2 { width: 400px; height: 400px; background: var(--brown-mid); bottom: -150px; left: -100px; }

.login-container {
  display: flex; width: 100%; max-width: 960px; min-height: 560px;
  border-radius: 28px; overflow: hidden;
  box-shadow: 0 24px 80px var(--shadow), 0 4px 20px rgba(44,26,14,0.06);
  position: relative; z-index: 1; margin: 20px;
  animation: fadeUp 0.5s ease forwards;
}

.left-panel {
  flex: 1;
  background: linear-gradient(145deg, var(--brown-dark) 0%, var(--brown-mid) 60%, var(--brown-light) 100%);
  padding: 56px 48px;
  display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden;
}
.left-panel::before { content: ''; position: absolute; width: 320px; height: 320px; border-radius: 50%; background: rgba(255,255,255,0.04); top: -80px; right: -80px; }
.left-panel::after { content: ''; position: absolute; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,0.04); bottom: 40px; left: -60px; }

.brand { position: relative; z-index: 2; }
.brand-icon { width: 52px; height: 52px; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 24px; margin-bottom: 24px; }
.brand-name { font-family: 'Playfair Display', serif; font-size: 38px; font-weight: 900; color: #fff; line-height: 1; letter-spacing: -1px; }
.brand-name span { color: var(--accent); }
.brand-tagline { color: rgba(255,255,255,0.55); font-size: 13px; margin-top: 8px; }

.left-content { position: relative; z-index: 2; }
.left-headline { font-family: 'Playfair Display', serif; font-size: 28px; font-weight: 700; color: #fff; line-height: 1.3; margin-bottom: 16px; }
.left-desc { color: rgba(255,255,255,0.6); font-size: 14px; line-height: 1.7; }

.features { position: relative; z-index: 2; display: flex; flex-direction: column; gap: 10px; }
.feature-item { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,0.75); font-size: 13px; }
.feature-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }

.right-panel { width: 420px; background: var(--warm-white); padding: 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.login-header { margin-bottom: 32px; }
.login-title { font-family: 'Playfair Display', serif; font-size: 30px; font-weight: 700; color: var(--brown-dark); margin-bottom: 6px; }
.login-subtitle { color: var(--text-muted); font-size: 14px; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 12px; font-weight: 600; color: var(--brown-mid); text-transform: uppercase; letter-spacing: 0.8px; margin-bottom: 8px; }
.input-wrap { position: relative; }
.input-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 16px; pointer-events: none; }
.form-input { width: 100%; padding: 13px 14px 13px 42px; border: 1.5px solid var(--border); border-radius: 12px; font-family: 'DM Sans', sans-serif; font-size: 14px; color: var(--brown-dark); background: #fff; outline: none; transition: all 0.2s; }
.form-input::placeholder { color: #c9b49a; }
.form-input:focus { border-color: var(--brown-light); box-shadow: 0 0 0 3px rgba(196,129,58,0.12); }
.form-input.no-icon { padding-left: 14px; }

.toggle-pass { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 15px; padding: 0; }

.form-footer { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.remember-wrap { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.remember-wrap input[type="checkbox"] { accent-color: var(--brown-light); width: 15px; height: 15px; }
.remember-wrap span { font-size: 13px; color: var(--text-muted); }

.btn-login { width: 100%; padding: 15px; background: linear-gradient(135deg, var(--brown-mid) 0%, var(--brown-light) 100%); color: #fff; border: none; border-radius: 12px; font-family: 'DM Sans', sans-serif; font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.25s; }
.btn-login:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(107,63,31,0.35); }

.divider { display: flex; align-items: center; gap: 12px; margin: 24px 0; color: var(--text-muted); font-size: 12px; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.powered { text-align: center; font-size: 12px; color: var(--text-muted); }
.powered strong { color: var(--brown-light); font-weight: 600; }

/* ---- ALERTS ---- */
.alert { padding: 12px 16px; border-radius: 10px; font-size: 13px; margin-bottom: 20px; }
.alert-error { background: #fef2f2; border: 1px solid #fecaca; color: var(--error); }
.alert-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: var(--success); }

/* ---- APP LAYOUT ---- */
body.app-page { background: var(--cream); }
.app-layout { display: flex; min-height: 100vh; }

/* SIDEBAR */
.sidebar { width: var(--sidebar-width); background: var(--brown-dark); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100; transition: transform 0.3s; overflow-y: auto; }
.sidebar-brand { padding: 24px 20px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.sidebar-logo { font-size: 24px; }
.sidebar-brandname { font-family: 'Playfair Display', serif; font-size: 22px; font-weight: 900; color: #fff; }
.sidebar-brandname span { color: var(--accent); }

.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-section { font-size: 10px; font-weight: 600; color: rgba(255,255,255,0.3); letter-spacing: 1.2px; text-transform: uppercase; padding: 12px 8px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; text-decoration: none; color: rgba(255,255,255,0.65); font-size: 14px; transition: all 0.2s; }
.nav-item:hover { background: rgba(255,255,255,0.07); color: #fff; }
.nav-item.active { background: var(--brown-light); color: #fff; font-weight: 600; }
.nav-icon { font-size: 16px; }

.sidebar-footer { padding: 12px; border-top: 1px solid rgba(255,255,255,0.08); }

/* MAIN CONTENT */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; }

/* TOPBAR */
.topbar { height: var(--topbar-height); background: var(--warm-white); border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; position: sticky; top: 0; z-index: 50; }
.topbar-left { display: flex; align-items: center; gap: 16px; }
.sidebar-toggle { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--brown-mid); display: none; }
.page-title { font-family: 'Playfair Display', serif; font-size: 20px; font-weight: 700; color: var(--brown-dark); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; background: var(--accent-light); border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 18px; }
.user-name { font-size: 13px; font-weight: 600; color: var(--brown-dark); }
.user-role { font-size: 11px; color: var(--text-muted); }
.btn-logout { font-size: 18px; text-decoration: none; padding: 6px; border-radius: 8px; transition: background 0.2s; }
.btn-logout:hover { background: var(--accent-light); }

/* PAGE CONTENT */
.page-content { padding: 24px; flex: 1; }

/* CARDS */
.card { background: var(--warm-white); border-radius: 16px; border: 1px solid var(--border); overflow: hidden; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 15px; font-weight: 600; color: var(--brown-dark); }
.card-body { padding: 20px; }

/* STATS GRID */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: var(--warm-white); border: 1px solid var(--border); border-radius: 16px; padding: 20px; display: flex; align-items: center; gap: 16px; transition: box-shadow 0.2s; }
.stat-card:hover { box-shadow: 0 4px 20px var(--shadow); }
.stat-card.accent { background: linear-gradient(135deg, var(--brown-mid), var(--brown-light)); border-color: transparent; }
.stat-card.accent .stat-label { color: rgba(255,255,255,0.7); }
.stat-card.accent .stat-value { color: #fff; }
.stat-icon { font-size: 28px; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.stat-value { font-size: 22px; font-weight: 700; color: var(--brown-dark); }

/* TABLE */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--cream); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--brown-dark); }
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: var(--cream); }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 10px; font-family: 'DM Sans', sans-serif; font-size: 14px; font-weight: 500; cursor: pointer; border: none; transition: all 0.2s; text-decoration: none; }
.btn-primary { background: linear-gradient(135deg, var(--brown-mid), var(--brown-light)); color: #fff; }
.btn-primary:hover { box-shadow: 0 4px 16px rgba(107,63,31,0.3); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--brown-mid); }
.btn-outline:hover { border-color: var(--brown-light); background: var(--accent-light); }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.btn-danger { background: #fef2f2; color: var(--error); border: 1px solid #fecaca; }
.btn-danger:hover { background: #fee2e2; }

/* BADGE */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; background: var(--accent-light); color: var(--brown-mid); }
.badge-success { background: #dcfce7; color: var(--success); }
.badge-error { background: #fef2f2; color: var(--error); }

/* UTILITIES */
.mt-4 { margin-top: 20px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }

/* ANIMATIONS */
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* RESPONSIVE */
@media (max-width: 768px) {
  .left-panel { display: none; }
  .right-panel { width: 100%; padding: 40px 28px; }
  .login-container { margin: 16px; border-radius: 20px; }
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: block; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

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