/* ── Reset & Base ──────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #6C63FF;
  --primary-dark: #5548E0;
  --primary-light: #EAE8FF;
  --success: #22C55E;
  --danger: #EF4444;
  --warning: #F59E0B;
  --bg: #F0F2F8;
  --card: #FFFFFF;
  --text: #1E1E2E;
  --text-muted: #6B7280;
  --border: #E5E7EB;
  --shadow: 0 2px 12px rgba(108,99,255,0.1);
  --shadow-lg: 0 8px 32px rgba(108,99,255,0.15);
  --radius: 14px;
  --radius-sm: 8px;
}

body {
  font-family: 'Segoe UI', Arial, sans-serif;
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
h1 { font-size: 1.6rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 1rem; color: var(--text); }
h3 { font-size: 1rem; font-weight: 600; }

/* ── Layout ────────────────────────────────────────────────────────────────── */
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* ── Header ────────────────────────────────────────────────────────────────── */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.header-brand { display: flex; align-items: center; gap: 12px; }

/* Brand Logo */
.brand-logo {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--primary) 0%, #9C8FFF 100%);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(108,99,255,0.35);
  flex-shrink: 0;
}
.brand-logo-r {
  color: white; font-size: 1.35rem; font-weight: 800;
  font-family: 'Segoe UI', Georgia, sans-serif; letter-spacing: -1px;
  line-height: 1;
}
.brand-text { display: block; white-space: nowrap; line-height: 1.3; }
.brand-title {
  display: inline;
  font-size: 1.05rem; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px;
}
.brand-dash { display: inline; color: var(--text-muted); font-weight: 400; }
.brand-sub-name {
  display: inline;
  font-size: 1.05rem; font-weight: 600; color: var(--primary);
}
.brand-tagline {
  display: block;
  font-size: 0.72rem; color: var(--text-muted); font-weight: 500;
  letter-spacing: 0.3px; margin-top: 2px;
}

.header-meta { display: flex; align-items: center; gap: 16px; color: var(--text-muted); font-size: 0.9rem; }
.header-meta .date-badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: 600;
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--radius-sm); border: none;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
  transition: all 0.18s; font-family: inherit;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 4px 12px rgba(108,99,255,0.35); }

.btn-success { background: var(--success); color: white; }
.btn-success:hover:not(:disabled) { background: #16A34A; box-shadow: 0 4px 12px rgba(34,197,94,0.35); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover:not(:disabled) { background: #DC2626; }

.btn-outline {
  background: transparent; border: 1.5px solid var(--border);
  color: var(--text-muted);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); background: var(--primary-light); }

.btn-ghost { background: transparent; color: var(--text-muted); padding: 6px 12px; }
.btn-ghost:hover { background: var(--bg); color: var(--text); }

.btn-sm { padding: 5px 12px; font-size: 0.8rem; }
.btn-lg { padding: 12px 28px; font-size: 1rem; }
.btn-icon { padding: 7px; border-radius: 8px; }

.btn-google {
  background: white; border: 1.5px solid var(--border); color: var(--text);
  gap: 10px;
}
.btn-google:hover { border-color: #4285F4; background: #F8F9FF; }

/* ── Cards ─────────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}
.card + .card { margin-top: 20px; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-weight: 600; font-size: 0.88rem; color: var(--text-muted); margin-bottom: 6px; }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.95rem; font-family: inherit;
  transition: border-color 0.18s; background: white; color: var(--text);
  direction: rtl;
}
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(108,99,255,0.12); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ── Login Page ────────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-card {
  background: white;
  padding: 40px 36px;
  border-radius: 20px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo .icon {
  width: 64px; height: 64px; border-radius: 18px;
  background: var(--primary); margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2rem;
}
.login-logo h2 { font-size: 1.3rem; color: var(--text); }
.login-logo p { color: var(--text-muted); font-size: 0.88rem; margin-top: 4px; }

.login-divider {
  display: flex; align-items: center; gap: 12px;
  margin: 16px 0; color: var(--text-muted); font-size: 0.85rem;
}
.login-divider::before, .login-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

.error-msg {
  background: #FEF2F2; border: 1px solid #FECACA;
  color: #DC2626; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 0.88rem; margin-bottom: 16px; display: none;
}
.error-msg.show { display: block; }

/* ── Timer Section ─────────────────────────────────────────────────────────── */
.timer-display {
  font-size: 5rem;
  font-weight: 700;
  text-align: center;
  color: var(--primary);
  letter-spacing: 4px;
  font-variant-numeric: tabular-nums;
  padding: 16px 0;
  line-height: 1;
}
.timer-display.running { color: var(--success); }
.timer-display.stopped { color: var(--warning); }

/* Start button blinks green while timer is running */
.btn-running {
  background: var(--success) !important;
  color: white !important;
  opacity: 1 !important;
  animation: btnBlink 1.2s ease-in-out infinite;
}
@keyframes btnBlink {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(34,197,94,0.5); }
  50% { opacity: 0.65; box-shadow: 0 0 0 8px rgba(34,197,94,0); }
}

.client-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.client-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 50px;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  color: white;
  font-family: inherit;
  opacity: 0.75;
}
.client-btn:hover { opacity: 1; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.2); }
.client-btn.active {
  opacity: 1;
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transform: scale(1.05);
  outline: 3px solid white;
  outline-offset: 2px;
}

.timer-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.active-client-badge {
  text-align: center;
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
  min-height: 22px;
}
.active-client-badge strong { color: var(--primary); }

/* ── Month Tabs ────────────────────────────────────────────────────────────── */
.month-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 20px;
  scrollbar-width: thin;
}
.month-tabs::-webkit-scrollbar { height: 4px; }
.month-tabs::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.month-tab {
  padding: 7px 16px;
  border: 1.5px solid var(--border);
  border-radius: 50px;
  background: white;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--text-muted);
  transition: all 0.15s;
  font-family: inherit;
}
.month-tab:hover { border-color: var(--primary); color: var(--primary); }
.month-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

/* ── Summary Cards ─────────────────────────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  background: white;
  border-radius: var(--radius);
  padding: 16px;
  border: 1.5px solid var(--border);
  text-align: center;
}
.summary-card .label { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; }
.summary-card .hours { font-size: 1.8rem; font-weight: 700; line-height: 1; }
.summary-card .sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.summary-card .dot {
  width: 10px; height: 10px; border-radius: 50%;
  display: inline-block; margin-left: 6px; vertical-align: middle;
}

/* ── Table ─────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
thead th {
  padding: 10px 14px;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--bg);
}
tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:hover { background: var(--primary-light); }
tbody tr:last-child td { border-bottom: none; }

.client-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
  color: white;
}

.time-badge {
  font-weight: 700; font-variant-numeric: tabular-nums;
  color: var(--primary); font-size: 0.95rem;
}

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.modal-overlay.open { opacity: 1; pointer-events: all; }

.modal {
  background: white; border-radius: var(--radius);
  width: 100%; max-width: 480px;
  box-shadow: var(--shadow-lg);
  transform: scale(0.95); transition: transform 0.2s;
  max-height: 90vh; overflow-y: auto;
}
.modal-overlay.open .modal { transform: scale(1); }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-body { padding: 24px; }
.modal-footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 16px 24px; border-top: 1px solid var(--border);
}

/* ── Admin Layout ──────────────────────────────────────────────────────────── */
.main-content { padding: 24px 24px; max-width: 1200px; margin: 0 auto; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.page-header h2 { margin-bottom: 0; }

.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.section-header h2 { margin-bottom: 0; }

/* ── Designer Layout ───────────────────────────────────────────────────────── */
.designer-grid {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  padding: 20px;
  max-width: 1100px;
  margin: 0 auto;
}
.designer-main { display: flex; flex-direction: column; gap: 20px; }
.designer-sidebar { display: flex; flex-direction: column; gap: 20px; }

/* ── Filter Bar ────────────────────────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-bottom: 16px;
}
.filter-bar select {
  padding: 8px 12px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 0.9rem;
  background: white; color: var(--text);
}
.filter-bar select:focus { outline: none; border-color: var(--primary); }

/* ── Color picker ──────────────────────────────────────────────────────────── */
.color-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.color-swatch {
  width: 28px; height: 28px; border-radius: 50%; cursor: pointer;
  border: 2px solid transparent; transition: all 0.15s;
}
.color-swatch:hover { transform: scale(1.2); }
.color-swatch.selected { border-color: var(--text); box-shadow: 0 0 0 2px white inset; }

/* ── Toast ─────────────────────────────────────────────────────────────────── */
.toast-container {
  position: fixed; bottom: 24px; left: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 9999;
}
.toast {
  background: var(--text); color: white;
  padding: 12px 18px; border-radius: var(--radius-sm);
  font-size: 0.88rem; box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(-20px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Responsive ────────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .designer-grid { grid-template-columns: 1fr; }
  .timer-display { font-size: 3.5rem; }
  header { padding: 0 14px; }
  .main-content, .designer-grid { padding: 12px; }
}

/* ── Scrollbar ─────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Misc ──────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 20px;
  font-size: 0.75rem; font-weight: 600;
}
.badge-admin { background: var(--primary-light); color: var(--primary); }
.badge-designer { background: #F0FDF4; color: #16A34A; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.8rem; }

hr { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.fw-bold { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mb-1 { margin-bottom: 8px; }
.gap-2 { gap: 16px; }
.flex { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* ── Auth Pages (login / register / setup) ──────────────────────────────── */
.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #6C63FF 0%, #9C8FFF 100%);
  padding: 24px;
}

.auth-card {
  background: var(--card);
  border-radius: 20px;
  padding: 40px 36px;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18);
}

.auth-logo {
  font-size: 2.8rem;
  text-align: center;
  margin-bottom: 12px;
}

.auth-title {
  font-size: 1.6rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 6px;
  color: var(--text);
}

.auth-sub {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 24px;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.error-msg {
  color: var(--danger);
  font-size: 0.88rem;
  margin-bottom: 10px;
  min-height: 18px;
  text-align: center;
}

.success-msg {
  background: #F0FDF4;
  border: 1px solid #86EFAC;
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  color: #16A34A;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

