:root {
  --bg: #0a0a0a;
  --bg2: #111;
  --bg3: #1a1a1a;
  --surface: #1e1e1e;
  --surface2: #252525;
  --gold: #C9B97A;
  --gold-light: #DDD0A0;
  --gold-dark: #A89A5A;
  --gold-glow: rgba(201,185,122,0.12);
  --text: #F5F0E8;
  --text2: #B8B0A0;
  --text3: #807868;
  --border: #2a2520;
  --border-gold: rgba(201,185,122,0.3);
  --success: #4CAF50;
  --warning: #FF9800;
  --danger: #F44336;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); min-height: 100vh; }

.login-container {
  min-height: 100vh; display: flex; justify-content: center; align-items: center;
  background: radial-gradient(ellipse at center, rgba(201,185,122,0.06) 0%, var(--bg) 70%);
}
.login-box {
  background: var(--surface); padding: 45px; border-radius: 24px;
  width: 100%; max-width: 420px; text-align: center;
  border: 1px solid var(--border-gold); box-shadow: var(--shadow);
}
.login-box h1 {
  font-family: 'Playfair Display', serif; font-size: 1.6rem;
  margin-bottom: 8px; color: var(--gold);
}
.login-box .login-subtitle { color: var(--text3); margin-bottom: 30px; font-size: 0.9rem; }
.login-box input {
  width: 100%; padding: 14px 18px; margin-bottom: 14px;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 1rem; background: var(--bg2); color: var(--text);
}
.login-box input:focus { outline: none; border-color: var(--gold); }
.login-box input::placeholder { color: var(--text3); }
.login-box .btn {
  width: 100%; padding: 15px; font-size: 1rem; font-weight: 600;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg); border: none; border-radius: 50px; cursor: pointer;
  transition: all 0.3s; margin-top: 5px;
}
.login-box .btn:hover { box-shadow: 0 8px 30px rgba(201,185,122,0.3); }
.login-error { color: var(--danger); margin-bottom: 12px; display: none; font-size: 0.9rem; }

.admin-header {
  background: var(--bg2); border-bottom: 1px solid var(--border-gold);
  padding: 16px 30px; display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 100;
}
.admin-header-left { display: flex; align-items: center; gap: 20px; }
.admin-header-left h1 {
  font-family: 'Playfair Display', serif; font-size: 1.2rem; color: var(--gold);
  display: flex; align-items: center; gap: 10px;
}
.total-badge {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg); padding: 8px 20px; border-radius: 30px;
  font-size: 1.6rem; font-weight: 800;
  font-family: 'Inter', sans-serif;
}
.total-label { font-size: 0.75rem; color: var(--text3); font-weight: 400; }
.admin-header-right { text-align: right; }
.admin-header-right .salon-name { font-weight: 600; color: var(--gold); font-size: 0.95rem; }
.admin-header-right .salon-address { font-size: 0.8rem; color: var(--text3); }
.admin-header-right .manager-name { font-size: 0.8rem; color: var(--text2); margin-top: 4px; }

.admin-body {
  display: grid; grid-template-columns: 1.2fr 0.8fr;
  gap: 25px; padding: 25px 30px; min-height: calc(100vh - 70px);
}

.panel {
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border); overflow: hidden;
}
.panel-header {
  padding: 18px 22px; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.panel-header h2 { font-size: 1rem; color: var(--gold); display: flex; align-items: center; gap: 8px; }
.panel-body { padding: 0; max-height: calc(100vh - 200px); overflow-y: auto; }

.hour-group { border-bottom: 1px solid var(--border); }
.hour-label {
  padding: 10px 22px; background: var(--bg2);
  font-weight: 600; font-size: 0.85rem; color: var(--gold);
  display: flex; justify-content: space-between; align-items: center;
  position: sticky; top: 0; z-index: 5;
}
.hour-count {
  font-size: 0.75rem; padding: 3px 10px; border-radius: 12px;
  background: var(--border-gold); color: var(--gold);
}
.booking-item {
  padding: 14px 22px; border-bottom: 1px solid rgba(42,37,32,0.5);
  display: flex; align-items: center; gap: 14px; transition: all 0.2s;
}
.booking-item:hover { background: var(--gold-glow); }
.booking-item:last-child { border-bottom: none; }

.booking-time { font-size: 1.1rem; font-weight: 700; color: var(--gold); min-width: 55px; }
.booking-info { flex: 1; }
.booking-info .name { font-weight: 600; font-size: 0.95rem; }
.booking-info .service { font-size: 0.82rem; color: var(--text3); }
.booking-info .phone { font-size: 0.8rem; color: var(--text3); }

.status-badge {
  padding: 5px 12px; border-radius: 20px; font-size: 0.72rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px;
}
.status-pending { background: rgba(255,152,0,0.15); color: var(--warning); }
.status-confirmed { background: rgba(76,175,80,0.15); color: var(--success); }
.status-cancelled { background: rgba(244,67,54,0.15); color: var(--danger); }
.status-completed { background: rgba(33,150,243,0.15); color: #42A5F5; }

.delivery-badge {
  padding: 3px 8px; border-radius: 12px; font-size: 0.7rem;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.3px; white-space: nowrap;
}
.delivery-sent { background: rgba(255,152,0,0.15); color: var(--warning); }
.delivery-delivered { background: rgba(76,175,80,0.15); color: var(--success); }
.delivery-read { background: rgba(33,150,243,0.15); color: #42A5F5; }
.delivery-failed { background: rgba(244,67,54,0.15); color: var(--danger); }

.queue-panel .panel-body { padding: 20px; }
.queue-current {
  text-align: center; padding: 30px 20px; margin-bottom: 20px;
  background: var(--bg2); border-radius: var(--radius); border: 1px solid var(--border-gold);
}
.queue-current .label { font-size: 0.8rem; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.queue-current .number {
  font-size: 4rem; font-weight: 800; color: var(--gold);
  line-height: 1; margin-bottom: 8px;
}
.queue-current .customer-name { font-size: 1.1rem; color: var(--text); font-weight: 600; }
.queue-current .customer-service { font-size: 0.85rem; color: var(--text3); margin-top: 4px; }

.queue-next {
  background: var(--bg2); border-radius: var(--radius); padding: 15px;
  margin-bottom: 20px;
}
.queue-next .label { font-size: 0.75rem; color: var(--text3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.queue-next-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.queue-next-item:last-child { border-bottom: none; }
.queue-next-num { color: var(--gold); font-weight: 700; min-width: 30px; }

.btn-next-customer {
  width: 100%; padding: 16px; font-size: 1.1rem; font-weight: 700;
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg); border: none; border-radius: var(--radius);
  cursor: pointer; transition: all 0.3s; display: flex; align-items: center;
  justify-content: center; gap: 10px;
}
.btn-next-customer:hover { box-shadow: 0 8px 30px rgba(201,185,122,0.3); transform: translateY(-2px); }
.btn-next-customer:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; }

.notification-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92); backdrop-filter: blur(12px);
  display: none; justify-content: center; align-items: center; z-index: 9999;
  animation: overlayPulse 2s ease-in-out infinite;
}
@keyframes overlayPulse {
  0%, 100% { background: rgba(0,0,0,0.92); }
  50% { background: rgba(201,185,122,0.08); }
}
.notification-overlay.show { display: flex; }
.notification-popup {
  background: var(--surface); border-radius: 24px; padding: 40px;
  max-width: 520px; width: 92%; text-align: center;
  animation: popIn 0.4s ease-out; border: 3px solid var(--gold);
  box-shadow: 0 0 60px rgba(201,185,122,0.3), 0 0 120px rgba(201,185,122,0.1);
}
@keyframes popIn { 0% { transform: scale(0.7) translateY(30px); opacity: 0; } 100% { transform: scale(1) translateY(0); opacity: 1; } }

.notification-popup .bell-icon {
  font-size: 6rem; margin-bottom: 10px;
  animation: bellSwing 0.6s ease-in-out infinite alternate;
  display: inline-block;
}
@keyframes bellSwing {
  0% { transform: rotate(-25deg) scale(1); }
  25% { transform: rotate(25deg) scale(1.1); }
  50% { transform: rotate(-20deg) scale(1); }
  75% { transform: rotate(20deg) scale(1.05); }
  100% { transform: rotate(-25deg) scale(1); }
}

.notification-popup h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.8rem; margin-bottom: 5px; color: var(--gold);
  animation: textPulse 1.5s ease-in-out infinite;
}
@keyframes textPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; text-shadow: 0 0 20px rgba(201,185,122,0.5); }
}
.notification-popup .popup-subtitle { font-size: 0.85rem; color: var(--text3); margin-bottom: 20px; }

.notification-popup .popup-counter {
  font-size: 0.8rem; color: var(--warning); margin-bottom: 8px; font-weight: 600;
}

.popup-booking-info {
  background: var(--bg2); padding: 20px; border-radius: var(--radius);
  margin: 15px 0 25px; text-align: left;
}
.popup-booking-info .info-row {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.popup-booking-info .info-row:last-child { border-bottom: none; }
.popup-booking-info .info-label { color: var(--text3); }
.popup-booking-info .info-value { font-weight: 600; color: var(--text); }

.popup-actions { display: flex; gap: 15px; margin-top: 10px; }
.popup-actions .btn { flex: 1; padding: 15px; font-size: 1rem; border: none; border-radius: var(--radius); cursor: pointer; font-weight: 700; transition: all 0.2s; }
.popup-actions .btn-reject { background: rgba(244,67,54,0.15); color: var(--danger); border: 2px solid var(--danger); }
.popup-actions .btn-reject:hover { background: var(--danger); color: white; }
.popup-actions .btn-accept { background: linear-gradient(135deg, var(--gold), var(--gold-dark)); color: var(--bg); }
.popup-actions .btn-accept:hover { box-shadow: 0 5px 20px rgba(201,185,122,0.3); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--text3); }
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state p { font-size: 0.9rem; }

.filter-row { display: flex; gap: 8px; }
.filter-btn {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px;
  background: transparent; color: var(--text3); cursor: pointer;
  font-size: 0.78rem; font-weight: 500; transition: all 0.2s;
}
.filter-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); }
.filter-select {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg2); color: var(--text2); font-size: 0.78rem; cursor: pointer;
}

.admin-date-picker {
  padding: 6px 14px; border: 1px solid var(--border); border-radius: 20px;
  background: var(--bg2); color: var(--text2); font-size: 0.78rem; cursor: pointer;
}

.admin-tabs {
  display: flex; gap: 5px;
}
.tab-btn {
  padding: 8px 20px; border: 1px solid var(--border); border-radius: 25px;
  background: transparent; color: var(--text3); cursor: pointer;
  font-size: 0.85rem; font-weight: 500; transition: all 0.2s;
  font-family: 'Inter', sans-serif;
}
.tab-btn.active { background: var(--gold); color: var(--bg); border-color: var(--gold); font-weight: 600; }
.tab-btn:hover:not(.active) { border-color: var(--gold); color: var(--gold); }

.users-table {
  width: 100%; border-collapse: collapse;
}
.users-table th {
  padding: 12px 18px; text-align: left; font-size: 0.78rem;
  color: var(--text3); text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.users-table td {
  padding: 14px 18px; border-bottom: 1px solid rgba(42,37,32,0.5);
  font-size: 0.9rem; vertical-align: middle;
}
.users-table tr:hover td { background: var(--gold-glow); }
.users-table code {
  background: var(--bg2); padding: 3px 8px; border-radius: 6px;
  font-size: 0.82rem; color: var(--text2);
}
.role-badge {
  padding: 4px 12px; border-radius: 15px; font-size: 0.75rem; font-weight: 600;
}
.role-admin { background: rgba(201,185,122,0.15); color: var(--gold); }
.role-manager { background: rgba(76,175,80,0.15); color: var(--success); }

.action-btn {
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; cursor: pointer; font-size: 0.9rem;
  transition: all 0.2s; margin: 0 2px;
}
.edit-btn:hover { border-color: var(--gold); background: var(--gold-glow); }
.delete-btn:hover { border-color: var(--danger); background: rgba(244,67,54,0.1); }

.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85); backdrop-filter: blur(8px);
  display: none; justify-content: center; align-items: center; z-index: 9998;
}
.modal-content {
  background: var(--surface); border-radius: 20px; padding: 35px;
  max-width: 480px; width: 92%;
  border: 1px solid var(--border-gold); box-shadow: var(--shadow);
  animation: popIn 0.3s ease-out;
}
.modal-content h2 {
  font-family: 'Playfair Display', serif; color: var(--gold);
  font-size: 1.3rem; margin-bottom: 20px;
}
.modal-form label {
  display: block; font-size: 0.82rem; color: var(--text3);
  margin-bottom: 5px; margin-top: 14px;
}
.modal-form label:first-child { margin-top: 0; }
.modal-form input, .modal-form select {
  width: 100%; padding: 12px 16px;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 0.95rem; background: var(--bg2); color: var(--text);
  font-family: 'Inter', sans-serif;
}
.modal-form input:focus, .modal-form select:focus { outline: none; border-color: var(--gold); }
.modal-form input::placeholder { color: var(--text3); }
.form-error { color: var(--danger); font-size: 0.85rem; margin-top: 12px; }

.modal-actions {
  display: flex; gap: 12px; margin-top: 24px;
}
.modal-actions .btn {
  flex: 1; padding: 13px; font-size: 0.95rem; border: none;
  border-radius: var(--radius); cursor: pointer; font-weight: 600;
  transition: all 0.2s; font-family: 'Inter', sans-serif;
}
.btn-cancel { background: var(--bg2); color: var(--text2); border: 1px solid var(--border) !important; }
.btn-cancel:hover { border-color: var(--text3) !important; }
.btn-save {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: var(--bg);
}
.btn-save:hover { box-shadow: 0 5px 20px rgba(201,185,122,0.3); }

.admin-header-center { display: flex; align-items: center; }

/* ── WhatsApp Management ── */
.wa-dashboard { padding: 0; }
.wa-stats-row {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px;
}
.wa-stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 16px; text-align: center;
  transition: all 0.3s;
}
.wa-stat-card:hover { border-color: var(--border-gold); transform: translateY(-2px); box-shadow: 0 8px 20px rgba(0,0,0,0.3); }
.wa-stat-icon { font-size: 1.8rem; margin-bottom: 6px; }
.wa-stat-value { font-size: 2rem; font-weight: 800; color: var(--text); line-height: 1.1; }
.wa-stat-label { font-size: 0.75rem; color: var(--text3); margin-top: 4px; }
.wa-stat-success .wa-stat-value { color: var(--success); }
.wa-stat-danger .wa-stat-value { color: var(--danger); }
.wa-stat-rate .wa-stat-value { color: var(--gold); }

.wa-section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

.wa-status-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; background: var(--bg2); border-radius: var(--radius);
  margin-bottom: 16px; border: 1px solid var(--border);
}
.wa-status-dot {
  width: 12px; height: 12px; border-radius: 50%;
  flex-shrink: 0; background: var(--text3);
}
.wa-dot-ok { background: var(--success); box-shadow: 0 0 8px rgba(76,175,80,0.5); animation: dotPulse 2s infinite; }
.wa-dot-warn { background: var(--warning); box-shadow: 0 0 8px rgba(255,152,0,0.5); }
.wa-dot-off { background: var(--danger); }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.wa-config-form label {
  display: block; font-size: 0.82rem; color: var(--text3);
  margin-bottom: 5px; margin-top: 12px;
}
.wa-config-form label:first-child { margin-top: 0; }
.wa-config-form input, .wa-config-form select {
  width: 100%; padding: 10px 14px;
  border: 2px solid var(--border); border-radius: var(--radius);
  font-size: 0.9rem; background: var(--bg2); color: var(--text);
  font-family: 'Inter', sans-serif;
}
.wa-config-form input:focus, .wa-config-form select:focus { outline: none; border-color: var(--gold); }

.wa-toggle-row { display: flex; align-items: center; gap: 12px; margin-top: 2px; }
.wa-switch { position: relative; display: inline-block; width: 48px; height: 26px; }
.wa-switch input { opacity: 0; width: 0; height: 0; }
.wa-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 26px; transition: 0.3s;
}
.wa-slider::before {
  content: ''; position: absolute; height: 20px; width: 20px;
  left: 3px; bottom: 3px; background: var(--text);
  border-radius: 50%; transition: 0.3s;
}
.wa-switch input:checked + .wa-slider { background: var(--success); }
.wa-switch input:checked + .wa-slider::before { transform: translateX(22px); }

.wa-report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.wa-report-block {
  background: var(--bg2); border-radius: var(--radius); padding: 18px;
  border: 1px solid var(--border);
}
.wa-report-block h3 { font-size: 0.88rem; color: var(--gold); margin-bottom: 14px; font-weight: 600; }
.wa-report-errors { grid-column: 1 / -1; }

.wa-bar-chart { display: flex; flex-direction: column; gap: 10px; }
.wa-bar-row { display: flex; align-items: center; gap: 10px; }
.wa-bar-label { font-size: 0.78rem; color: var(--text2); min-width: 100px; white-space: nowrap; }
.wa-bar-track { flex: 1; height: 22px; background: var(--surface); border-radius: 6px; overflow: hidden; }
.wa-bar-fill { height: 100%; background: linear-gradient(90deg, var(--gold-dark), var(--gold)); border-radius: 6px; min-width: 2px; transition: width 0.6s ease; }
.wa-bar-value { font-size: 0.75rem; color: var(--text3); min-width: 110px; text-align: right; }

.wa-daily-chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; }
.wa-daily-col { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; }
.wa-daily-bar-wrap { flex: 1; width: 100%; display: flex; flex-direction: column; justify-content: flex-end; position: relative; }
.wa-daily-bar-sent {
  width: 100%; background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 4px 4px 0 0; min-height: 0; transition: height 0.6s ease;
}
.wa-daily-bar-fail {
  width: 100%; background: var(--danger); border-radius: 0;
  min-height: 0; transition: height 0.6s ease; position: absolute; bottom: 0;
}
.wa-daily-date { font-size: 0.65rem; color: var(--text3); margin-top: 4px; }
.wa-daily-num { font-size: 0.65rem; color: var(--text2); font-weight: 600; }

.wa-hourly-chart { display: flex; align-items: flex-end; gap: 2px; height: 100px; }
.wa-hourly-col { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; }
.wa-hourly-bar {
  width: 100%; background: linear-gradient(180deg, var(--gold), var(--gold-dark));
  border-radius: 3px 3px 0 0; margin-top: auto; transition: height 0.6s ease;
}
.wa-hourly-label { font-size: 0.6rem; color: var(--text3); margin-top: 3px; }

.wa-errors-list { display: flex; flex-direction: column; gap: 8px; }
.wa-error-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px; background: rgba(244,67,54,0.05); border-radius: 8px; border-left: 3px solid var(--danger);
}
.wa-error-count { color: var(--danger); font-weight: 700; font-size: 0.85rem; min-width: 32px; }
.wa-error-msg { color: var(--text2); font-size: 0.82rem; word-break: break-word; }

.wa-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.wa-detail-row {
  padding: 10px 14px; background: var(--bg2); border-radius: 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.wa-detail-row span { color: var(--text3); font-size: 0.82rem; }
.wa-detail-row strong { color: var(--text); font-size: 0.88rem; }

@media (max-width: 1024px) {
  .admin-body { grid-template-columns: 1fr; }
  .admin-header { flex-direction: column; gap: 12px; text-align: center; }
  .admin-header-right { text-align: center; }
  .users-table { font-size: 0.82rem; }
  .users-table th, .users-table td { padding: 10px 12px; }
  .wa-stats-row { grid-template-columns: repeat(3, 1fr); }
  .wa-section-grid { grid-template-columns: 1fr; }
  .wa-report-grid { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .admin-body { padding: 15px; }
  .popup-actions { flex-direction: column; }
  .modal-content { padding: 25px; }
  .modal-actions { flex-direction: column; }
  .admin-tabs { gap: 3px; }
  .tab-btn { padding: 6px 14px; font-size: 0.78rem; }
  .filter-row { flex-wrap: wrap; }
  .wa-stats-row { grid-template-columns: repeat(2, 1fr); }
  .wa-stat-value { font-size: 1.4rem; }
  .wa-daily-chart { height: 100px; }
  .wa-detail-grid { grid-template-columns: 1fr; }
  .admin-tabs { flex-wrap: wrap; justify-content: center; }
}

.lang-btn-admin {
  padding: 3px 8px;
  font-size: 0.72rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
.lang-btn-admin.active {
  background: var(--gold);
  color: var(--bg);
  border-color: var(--gold);
}
