/* =========================================================
   APPOINTLY - PREMIUM APP STYLE THEME
   Author: Mr Arslan (CEO)
   ========================================================= */

:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #8b5cf6;
  --accent: #ec4899;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #06b6d4;

  --grad-primary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #ec4899 100%);
  --grad-success: linear-gradient(135deg, #10b981, #059669);
  --grad-warning: linear-gradient(135deg, #f59e0b, #d97706);
  --grad-danger: linear-gradient(135deg, #ef4444, #dc2626);
  --grad-info: linear-gradient(135deg, #06b6d4, #0891b2);

  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --hover: #f1f5f9;

  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.06);
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.10);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
}

[data-theme="dark"] {
  --bg: #0f172a;
  --card: #1e293b;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --hover: #334155;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.3);
  --shadow: 0 8px 24px rgba(0,0,0,.4);
  --shadow-lg: 0 20px 40px rgba(0,0,0,.5);
}

* { box-sizing: border-box; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
}

a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); }

.material-icons-round { vertical-align: middle; }

/* ================== AUTH PAGES (Login/Signup) ================== */
.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: var(--grad-primary);
  position: relative;
  overflow: hidden;
}
.auth-wrapper::before {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  background: rgba(255,255,255,0.1);
  border-radius: 50%;
  top: -200px; right: -200px;
  filter: blur(80px);
}
.auth-wrapper::after {
  content: '';
  position: absolute;
  width: 400px; height: 400px;
  background: rgba(236, 72, 153, 0.2);
  border-radius: 50%;
  bottom: -150px; left: -150px;
  filter: blur(80px);
}
.auth-card {
  background: rgba(255,255,255,0.97);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-radius: 28px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.25);
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 2;
  border: 1px solid rgba(255,255,255,0.3);
}
[data-theme="dark"] .auth-card {
  background: rgba(30,41,59,0.95);
  color: #f1f5f9;
  border: 1px solid rgba(255,255,255,0.1);
}
.auth-logo {
  width: 80px; height: 80px;
  background: var(--grad-primary);
  border-radius: 24px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 36px;
  margin: 0 auto 18px;
  box-shadow: 0 15px 30px rgba(99,102,241,.4);
}
.auth-title {
  font-weight: 800;
  font-size: 26px;
  text-align: center;
  margin-bottom: 6px;
}
.auth-subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 28px;
  font-size: 14px;
}

/* ================== FORMS ================== */
.form-control, .form-select {
  border-radius: 12px !important;
  padding: 12px 16px !important;
  border: 1.5px solid var(--border) !important;
  background: var(--card) !important;
  color: var(--text) !important;
  font-size: 14px;
  transition: all .25s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 4px rgba(99,102,241,.15) !important;
}
.form-label { font-weight: 600; font-size: 13px; margin-bottom: 6px; color: var(--text); }

.input-group-text {
  background: transparent;
  border: 1.5px solid var(--border);
  border-right: none;
  border-radius: 12px 0 0 12px !important;
  color: var(--text-muted);
}
.input-group .form-control {
  border-left: none;
  border-radius: 0 12px 12px 0 !important;
}

/* ================== BUTTONS ================== */
.btn {
  border-radius: 12px;
  padding: 11px 22px;
  font-weight: 600;
  font-size: 14px;
  transition: all .25s;
  border: none;
}
.btn-primary {
  background: var(--grad-primary);
  color: #fff;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(99,102,241,.4);
  color: #fff;
}
.btn-outline-primary {
  border: 1.5px solid var(--primary);
  color: var(--primary);
  background: transparent;
}
.btn-outline-primary:hover { background: var(--primary); color: #fff; }
.btn-success { background: var(--grad-success); color: #fff; }
.btn-warning { background: var(--grad-warning); color: #fff; }
.btn-danger  { background: var(--grad-danger); color: #fff; }
.btn-light, .btn-secondary { background: var(--hover); color: var(--text); }

/* ================== CARDS ================== */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  transition: all .25s;
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-weight: 700;
  padding: 18px 22px;
}
.card-body { padding: 22px; }

/* ================== APP LAYOUT ================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}
.app-sidebar {
  width: 260px;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 24px 16px;
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  transition: transform .3s;
}
.app-main {
  flex: 1;
  margin-left: 260px;
  padding: 24px;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.sidebar-brand .logo-mark {
  width: 44px; height: 44px;
  background: var(--grad-primary);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 22px;
}
.sidebar-brand h5 { font-weight: 800; margin: 0; font-size: 18px; }
.sidebar-brand small { color: var(--text-muted); font-size: 11px; }

.nav-link {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 4px;
  transition: all .2s;
}
.nav-link:hover {
  background: var(--hover);
  color: var(--text);
}
.nav-link.active {
  background: var(--grad-primary);
  color: #fff !important;
  box-shadow: 0 8px 20px rgba(99,102,241,.35);
}
.nav-link .material-icons-round { font-size: 22px; }

/* ================== TOPBAR ================== */
.app-topbar {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.app-topbar h4 { margin: 0; font-weight: 800; font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all .2s;
}
.icon-btn:hover { background: var(--hover); transform: translateY(-2px); }
.user-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 50px;
  background: var(--hover);
  cursor: pointer;
}
.user-pill .avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--grad-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* ================== STAT CARDS ================== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: all .3s;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.stat-card .icon {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 26px;
  margin-bottom: 14px;
}
.stat-card .icon.bg-primary { background: var(--grad-primary); }
.stat-card .icon.bg-success { background: var(--grad-success); }
.stat-card .icon.bg-warning { background: var(--grad-warning); }
.stat-card .icon.bg-danger  { background: var(--grad-danger); }
.stat-card .icon.bg-info    { background: var(--grad-info); }
.stat-card .label { color: var(--text-muted); font-size: 13px; font-weight: 600; }
.stat-card .value { font-size: 30px; font-weight: 800; margin-top: 4px; }
.stat-card .trend { font-size: 12px; margin-top: 6px; color: var(--success); font-weight: 600; }

/* ================== TABLES ================== */
.table-card { background: var(--card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
.table {
  margin: 0;
  color: var(--text);
}
.table thead th {
  background: var(--hover);
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  font-weight: 700;
  padding: 14px 18px;
}
.table tbody td {
  padding: 14px 18px;
  border-color: var(--border);
  vertical-align: middle;
  font-size: 14px;
}
.table tbody tr:hover { background: var(--hover); }

/* ================== BADGES ================== */
.badge-pill {
  padding: 6px 12px;
  border-radius: 50px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.badge-pending  { background: rgba(245,158,11,.15); color: #d97706; }
.badge-approved { background: rgba(16,185,129,.15); color: #059669; }
.badge-rejected { background: rgba(239,68,68,.15);  color: #dc2626; }
.badge-completed{ background: rgba(99,102,241,.15); color: #4f46e5; }
.badge-cancelled{ background: rgba(100,116,139,.15);color: #475569; }
.badge-active   { background: rgba(16,185,129,.15); color: #059669; }
.badge-inactive { background: rgba(100,116,139,.15);color: #475569; }

/* ================== USER MOBILE APP UI ================== */
.mobile-shell {
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  padding-bottom: 90px;
}
.mobile-header {
  background: var(--grad-primary);
  color: #fff;
  padding: 28px 22px 36px;
  border-radius: 0 0 28px 28px;
  position: relative;
}
.mobile-header.simple { padding: 18px 22px; border-radius: 0; }
.mobile-header h2 { font-weight: 800; margin: 0; font-size: 22px; }
.mobile-header .greeting { opacity: .9; font-size: 13px; }
.mobile-header .avatar-circle {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: rgba(255,255,255,.25);
  border: 2px solid rgba(255,255,255,.4);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.mobile-content { padding: 18px 18px 30px; }
.mobile-section-title {
  font-weight: 700;
  font-size: 16px;
  margin: 18px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mini-stat {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.mini-stat .v { font-size: 22px; font-weight: 800; }
.mini-stat .l { font-size: 12px; color: var(--text-muted); }

.service-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  gap: 14px;
  align-items: center;
  transition: all .2s;
  cursor: pointer;
}
.service-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.service-card .icon-box {
  width: 56px; height: 56px;
  border-radius: 16px;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 28px;
  flex-shrink: 0;
}
.service-card .info { flex: 1; min-width: 0; }
.service-card .info h6 { margin: 0; font-weight: 700; font-size: 15px; }
.service-card .info p { margin: 2px 0 0; color: var(--text-muted); font-size: 12px; }
.service-card .meta { font-size: 12px; color: var(--primary); font-weight: 700; }

.appt-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 16px;
  margin-bottom: 12px;
  display: flex; gap: 14px; align-items: center;
}
.appt-card .date-box {
  width: 64px;
  text-align: center;
  border-radius: 14px;
  background: var(--grad-primary);
  color: #fff;
  padding: 10px 6px;
  flex-shrink: 0;
}
.appt-card .date-box .d { font-size: 22px; font-weight: 800; line-height: 1; }
.appt-card .date-box .m { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.appt-card .info { flex: 1; min-width: 0; }
.appt-card .info h6 { margin: 0; font-weight: 700; font-size: 14px; }
.appt-card .info p { margin: 4px 0 0; color: var(--text-muted); font-size: 12px; }

/* Bottom Nav */
.bottom-nav {
  position: fixed;
  bottom: 12px; left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 440px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 15px 40px rgba(0,0,0,.12);
  display: flex;
  justify-content: space-around;
  padding: 8px 6px;
  z-index: 100;
}
.bottom-nav a {
  flex: 1;
  text-align: center;
  padding: 8px 4px;
  border-radius: 14px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  transition: all .2s;
}
.bottom-nav a .material-icons-round { font-size: 24px; display: block; margin-bottom: 2px; }
.bottom-nav a.active {
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(99,102,241,.35);
}

/* ================== CALENDAR ================== */
.calendar-wrap {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  border: 1px solid var(--border);
}
.calendar-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.calendar-grid .dn {
  text-align: center; font-size: 11px; font-weight: 700; color: var(--text-muted);
  padding: 6px 0;
}
.calendar-day {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  border: 1px solid transparent;
  transition: all .2s;
}
.calendar-day:hover { background: var(--hover); }
.calendar-day.muted { color: #cbd5e1; cursor: not-allowed; }
.calendar-day.today { border-color: var(--primary); color: var(--primary); }
.calendar-day.selected {
  background: var(--grad-primary); color: #fff;
  box-shadow: 0 8px 20px rgba(99,102,241,.4);
}
.calendar-day.disabled { color: #cbd5e1; cursor: not-allowed; opacity: .4; }

/* Time slots */
.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 8px; }
.slot {
  padding: 10px 8px;
  border-radius: 12px;
  background: var(--card);
  border: 1.5px solid var(--border);
  text-align: center;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all .2s;
}
.slot:hover { border-color: var(--primary); }
.slot.selected { background: var(--grad-primary); color: #fff; border-color: transparent; }
.slot.booked { opacity: .35; cursor: not-allowed; text-decoration: line-through; }

/* ================== TOAST ================== */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 9999;
}
.app-toast {
  background: var(--card);
  border-left: 4px solid var(--primary);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 10px;
  min-width: 280px;
  box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 12px;
  animation: slideIn .3s;
}
.app-toast.success { border-color: var(--success); }
.app-toast.error { border-color: var(--danger); }
.app-toast.warning { border-color: var(--warning); }
@keyframes slideIn { from { transform: translateX(120%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ================== LOADER ================== */
.loader-overlay {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.4);
  backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 9999;
}
.loader-overlay.active { display: flex; }
.spinner-c {
  width: 60px; height: 60px;
  border: 5px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================== MOBILE ================== */
.mobile-toggle {
  display: none;
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--card);
  align-items: center; justify-content: center;
  cursor: pointer;
}

@media (max-width: 992px) {
  .app-sidebar { transform: translateX(-100%); }
  .app-sidebar.open { transform: translateX(0); }
  .app-main { margin-left: 0; padding: 16px; }
  .mobile-toggle { display: flex; }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 49;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
}

/* Splash */
.splash {
  position: fixed; inset: 0;
  background: var(--grad-primary);
  display: flex; align-items: center; justify-content: center;
  flex-direction: column;
  z-index: 99999;
  color: #fff;
  animation: fadeOut .4s ease-in 1.5s forwards;
}
.splash .logo {
  width: 120px; height: 120px;
  background: rgba(255,255,255,.2);
  border-radius: 32px;
  display: flex; align-items: center; justify-content: center;
  font-size: 60px;
  margin-bottom: 18px;
  animation: bounce 1.5s infinite;
}
.splash h1 { font-weight: 800; }
@keyframes bounce { 0%,100%{transform:scale(1)} 50%{transform:scale(1.06)} }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }

/* Empty state */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-muted);
}
.empty .material-icons-round { font-size: 70px; opacity: .35; margin-bottom: 10px; }

/* Modal */
.modal-content {
  background: var(--card);
  color: var(--text);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
}
.modal-header { border-bottom: 1px solid var(--border); }
.modal-footer { border-top: 1px solid var(--border); }
