@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@300;400;500&family=Inter:wght@200;300;400;500;600&display=swap');

:root {
  --cream: #FFF8DC;
  --brown: #8B4513;
  --brown-light: #A0522D;
  --beige: #F5F5DC;
  --gold: #C8A96B;
  --white: #FFFFFF;
  --text: #4A3728;
  --text-light: #8B7355;
  --border: rgba(139, 69, 19, 0.1);
  --shadow: 0 4px 24px rgba(139, 69, 19, 0.06);
  --shadow-lg: 0 8px 40px rgba(139, 69, 19, 0.1);
}

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

/* LOADER */
.loader {
  position: fixed;
  inset: 0;
  background: #FFF8DC;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
  transition: opacity 0.8s ease;
}
.loader.hide { opacity: 0; pointer-events: none; }
.particles { position: absolute; inset: 0; pointer-events: none; }
.particles span { position: absolute; width: 3px; height: 3px; background: #8B4513; border-radius: 50%; opacity: 0; animation: drift 5s ease-in-out infinite; }
.particles span:nth-child(1){left:15%;top:20%;animation-delay:0s}
.particles span:nth-child(2){left:75%;top:15%;animation-delay:.7s}
.particles span:nth-child(3){left:25%;top:70%;animation-delay:1.2s}
.particles span:nth-child(4){left:80%;top:65%;animation-delay:.4s}
.particles span:nth-child(5){left:50%;top:85%;animation-delay:1.8s}
.particles span:nth-child(6){left:10%;top:50%;animation-delay:.9s}
.particles span:nth-child(7){left:90%;top:40%;animation-delay:1.5s}
.particles span:nth-child(8){left:40%;top:10%;animation-delay:2.1s}
@keyframes drift{0%,100%{opacity:0;transform:translateY(0) scale(0)}25%{opacity:.6;transform:translateY(-20px) scale(1.5)}75%{opacity:.3;transform:translateY(-60px) scale(.8)}}
.ring { position: absolute; border: 1px solid rgba(139,69,19,.1); border-radius: 50%; opacity: 0; animation: ringPulse 3s ease-out infinite; }
.ring:nth-child(2){width:200px;height:200px;animation-delay:0s}
.ring:nth-child(3){width:300px;height:300px;animation-delay:1s}
.ring:nth-child(4){width:400px;height:400px;animation-delay:2s}
@keyframes ringPulse{0%{opacity:0;transform:scale(.6)}50%{opacity:.3}100%{opacity:0;transform:scale(1.2)}}
.loader-brand { position: relative; z-index: 2; text-align: center; }
.loader-brand::before { content:''; position:absolute; top:50%; left:50%; transform:translate(-50%,-50%); width:300px; height:300px; background:radial-gradient(circle,rgba(139,69,19,.04) 0%,transparent 70%); border-radius:50%; animation:glowPulse 3s ease-in-out infinite; }
@keyframes glowPulse{0%,100%{opacity:.5;transform:translate(-50%,-50%) scale(1)}50%{opacity:1;transform:translate(-50%,-50%) scale(1.1)}}
.loader-title { font-family:'Playfair Display',serif; font-size:56px; font-weight:300; color:#8B4513; letter-spacing:16px; opacity:0; animation:revealUp 1.2s ease-out .8s forwards; }
.flourish { opacity:0; animation:revealUp .8s ease-out 2s forwards; margin:12px 0; }
.flourish svg { width:80px; height:20px; }
.loader-tagline { font-size:12px; letter-spacing:6px; text-transform:uppercase; color:#A0522D; opacity:0; animation:revealUp .8s ease-out 2.5s forwards; }
.loader-progress { position:absolute; bottom:60px; width:120px; height:1px; background:rgba(139,69,19,.15); border-radius:1px; overflow:hidden; }
.loader-progress-bar { height:100%; width:0; background:#8B4513; animation:progressFill 4.5s ease-in-out .5s forwards; }
@keyframes revealUp{0%{opacity:0;transform:translateY(15px)}100%{opacity:1;transform:translateY(0)}}
@keyframes progressFill{0%{width:0}100%{width:100%}}

body {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  background: var(--cream);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
  width: 240px;
  background: var(--brown);
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.sidebar-logo {
  font-family: 'Playfair Display', serif;
  font-size: 22px;
  font-weight: 300;
  color: var(--cream);
  letter-spacing: 6px;
  text-align: center;
  padding: 0 24px 24px;
  border-bottom: 1px solid rgba(255, 248, 220, 0.1);
}

.sidebar-nav {
  flex: 1;
  padding: 20px 0;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 28px;
  color: rgba(255, 248, 220, 0.6);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  letter-spacing: 0.5px;
  transition: all 0.3s;
}

.sidebar-nav a:hover, .sidebar-nav a.active {
  color: var(--cream);
  background: rgba(255, 248, 220, 0.08);
  border-right: 2px solid var(--gold);
}

.sidebar-nav a svg { opacity: 0.7; }
.sidebar-nav a:hover svg, .sidebar-nav a.active svg { opacity: 1; }

.sidebar-footer {
  padding: 16px 28px;
  border-top: 1px solid rgba(255, 248, 220, 0.1);
}

.sidebar-footer a {
  color: rgba(255, 248, 220, 0.4);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 1px;
}

/* MAIN */
.main {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  width: calc(100vw - 240px);
  min-height: 100vh;
}

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

.main-header h1 {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 400;
  color: var(--brown);
}

.main-header p {
  font-size: 12px;
  color: var(--text-light);
}

.header-actions {
  display: flex;
  gap: 10px;
}

.btn {
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.3s;
  border: none;
}

.btn-primary {
  background: var(--brown);
  color: var(--cream);
}

.btn-primary:hover { background: var(--brown-light); }

.btn-outline {
  background: none;
  border: 1px solid var(--border);
  color: var(--text);
}

.btn-outline:hover { border-color: var(--brown); }

/* STATS */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  padding: 22px;
  border-radius: 12px;
  border: 1px solid var(--border);
  transition: all 0.3s;
}

.stat-card:hover { box-shadow: var(--shadow); }

.stat-card .label {
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.stat-card .value {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 400;
  color: var(--brown);
}

.stat-card .change {
  font-size: 10px;
  color: #27ae60;
  margin-top: 4px;
}

/* GRID LAYOUT */
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.grid-equal {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
  width: 100%;
}

/* CARD */
.card {
  background: var(--white);
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 20px;
  transition: all 0.3s;
  overflow-x: auto;
  width: 100%;
}

.card:hover { box-shadow: var(--shadow); }

.card table {
  width: 100%;
  min-width: 100%;
}

.card-title {
  font-family: 'Playfair Display', serif;
  font-size: 16px;
  font-weight: 400;
  color: var(--brown);
  margin-bottom: 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-title .badge {
  font-family: 'Inter', sans-serif;
  font-size: 10px;
  background: var(--beige);
  color: var(--brown-light);
  padding: 4px 10px;
  border-radius: 20px;
}

/* TABLE */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-light);
  padding: 10px 14px;
  background: var(--beige);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
  text-overflow: ellipsis;
}

td {
  padding: 14px 14px;
  font-size: 12px;
  border-bottom: 1px solid rgba(139, 69, 19, 0.06);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

tbody tr:hover { background: rgba(245, 245, 220, 0.4); }

.status {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 20px;
  font-weight: 500;
}

.status-confirmed { background: #e8f5e9; color: #2e7d32; }
.status-pending { background: #fff3e0; color: #e65100; }
.status-completed { background: var(--beige); color: var(--brown); }

/* CHART */
.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 120px;
  padding-top: 10px;
}

.chart-bar {
  flex: 1;
  background: linear-gradient(180deg, var(--brown) 0%, var(--brown-light) 100%);
  border-radius: 4px 4px 0 0;
  position: relative;
  transition: all 0.3s;
  opacity: 0.7;
}

.chart-bar:hover { opacity: 1; }

.chart-bar .chart-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-light);
}

/* POPULAR SERVICES */
.service-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid rgba(139, 69, 19, 0.05);
}

.service-item:last-child { border: none; }

.service-rank {
  width: 24px;
  height: 24px;
  background: var(--beige);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--brown);
  margin-right: 12px;
}

.service-info { flex: 1; }
.service-info h4 { font-size: 13px; font-weight: 400; }
.service-info p { font-size: 11px; color: var(--text-light); }
.service-count { font-size: 13px; font-weight: 500; color: var(--brown); }

/* NOTES */
.note-item {
  padding: 12px 14px;
  background: var(--beige);
  border-radius: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  line-height: 1.5;
  border-left: 3px solid var(--gold);
}

/* CUSTOMERS */
.customer-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(139, 69, 19, 0.05);
}

.customer-item:last-child { border: none; }

.customer-avatar {
  width: 36px;
  height: 36px;
  background: var(--beige);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--brown);
}

.customer-info { flex: 1; }
.customer-info h4 { font-size: 13px; font-weight: 400; }
.customer-info p { font-size: 11px; color: var(--text-light); }
.customer-visits { font-size: 11px; color: var(--text-light); }

/* BIRTHDAY ALERTS */
.birthday-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(139, 69, 19, 0.05);
}

.birthday-item:last-child { border: none; }
.birthday-icon { font-size: 18px; }
.birthday-info h4 { font-size: 12px; font-weight: 400; }
.birthday-info p { font-size: 10px; color: var(--text-light); }

/* STAFF */
.staff-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.staff-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.staff-dot.online { background: #27ae60; }
.staff-dot.offline { background: #ccc; }

.staff-name { font-size: 13px; flex: 1; }
.staff-status { font-size: 11px; color: var(--text-light); }

/* AI CHAT WIDGET */
.ai-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 52px;
  height: 52px;
  background: var(--brown);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  transition: all 0.3s;
  z-index: 50;
}

.ai-chat-btn:hover { transform: scale(1.05); }

.ai-chat-panel {
  position: fixed;
  bottom: 88px;
  right: 24px;
  width: 320px;
  height: 400px;
  background: var(--white);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 50;
}

.ai-chat-panel.open { display: flex; }

.ai-chat-header {
  padding: 16px;
  background: var(--brown);
  color: var(--cream);
  font-size: 13px;
  font-weight: 400;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.ai-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.5;
}

.chat-msg.user {
  align-self: flex-end;
  background: var(--brown);
  color: var(--cream);
  border-bottom-right-radius: 4px;
}

.chat-msg.bot {
  align-self: flex-start;
  background: var(--beige);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.ai-chat-input {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
}

.ai-chat-input input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'Inter', sans-serif;
  outline: none;
}

.ai-chat-input button {
  background: var(--brown);
  color: var(--cream);
  border: none;
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 11px;
  cursor: pointer;
}

/* LOW STOCK */
.stock-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(139, 69, 19, 0.05);
}

.stock-item:last-child { border: none; }
.stock-name { font-size: 12px; }
.stock-qty { font-size: 11px; color: #e74c3c; font-weight: 500; }

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(74, 55, 40, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.modal h2 {
  font-family: 'Playfair Display', serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--brown);
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 11px;
  color: var(--text-light);
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  outline: none;
  background: var(--white);
  transition: border-color 0.3s;
}

.form-group input:focus, .form-group select:focus {
  border-color: var(--brown);
}

@media (max-width: 1024px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2, .grid-equal { grid-template-columns: 1fr; }
}

/* BACK TO ADCX */
.back-adcx {
  position: fixed;
  top: 12px;
  right: 16px;
  background: var(--white);
  color: var(--brown);
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 500;
  text-decoration: none;
  letter-spacing: 0.5px;
  border: 1px solid var(--border);
  z-index: 30;
  transition: all 0.3s;
}
.back-adcx:hover { background: var(--brown); color: var(--cream); }

/* MOBILE HEADER */
.mobile-header {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: var(--brown);
  z-index: 20;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.mobile-logo {
  font-family: 'Playfair Display', serif;
  font-size: 18px;
  font-weight: 300;
  color: var(--cream);
  letter-spacing: 4px;
}

.mobile-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
}

.mobile-menu-btn span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--cream);
  border-radius: 2px;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 9;
}

.sidebar-overlay.open { display: block; }

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar { 
    transform: translateX(-100%); 
    transition: transform 0.3s ease;
    z-index: 11;
  }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; padding: 72px 16px 16px; width: 100%; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 16px; }
  .stat-card .value { font-size: 22px; }
  .grid-2, .grid-equal { grid-template-columns: 1fr; }
  .main-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; text-align: center; }
  .card { padding: 16px; }
  .ai-chat-panel { width: calc(100vw - 32px); right: 16px; }
}
