:root {
  /* Dark Mode (Default) */
  --bg-color: #0b132b;
  --bg-element: #1c2541;
  --bg-selected: #3a506b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --color-primary: #60a5fa;
  --color-primary-rgb: 96, 165, 250;
  --color-primary-container: #1e3a8a;
  --color-secondary: #f59e0b;
  --color-secondary-container: #78350f;
  --border-color: #334155;
  --success-color: #34d399;
  --warning-color: #fbbf24;
  --error-color: #f87171;
  --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --glass-bg: rgba(28, 37, 65, 0.75);
  --glass-border: rgba(255, 255, 255, 0.08);
}

.light-theme {
  /* Light Mode Switch */
  --bg-color: #f9f9ff;
  --bg-element: #ffffff;
  --bg-selected: #e7eeff;
  --text-primary: #111c2c;
  --text-secondary: #43474e;
  --color-primary: #1a365d;
  --color-primary-rgb: 26, 54, 93;
  --color-primary-container: #dde2f9;
  --color-secondary: #d4af37;
  --color-secondary-container: #ffe082;
  --border-color: #e2e8 Slate;
  --border-color: #e2e8f0;
  --success-color: #2d6a4f;
  --warning-color: #d97706;
  --error-color: #ba1a1a;
  --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --glass-bg: rgba(255, 255, 255, 0.85);
  --glass-border: rgba(226, 232, 240, 0.8);
}

body.dashboard-body {
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Outfit', 'Georama', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--bg-selected);
}

/* Layout Structure */
.dashboard-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100vw;
}

/* Sidebar Styling */
.dashboard-sidebar {
  width: 280px;
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.sidebar-brand {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--glass-border);
}

.sidebar-brand-text {
  font-size: 1.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--color-primary), var(--color-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.5px;
}

.sidebar-menu {
  list-style: none;
  padding: 16px 12px;
  margin: 0;
  flex-grow: 1;
  overflow-y: auto;
}

.sidebar-menu-item {
  margin-bottom: 6px;
}

.sidebar-menu-link {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.sidebar-menu-link i {
  font-size: 1.25rem;
}

.sidebar-menu-link:hover {
  background: rgba(var(--color-primary-rgb), 0.08);
  color: var(--color-primary);
}

.sidebar-menu-item.active .sidebar-menu-link {
  background: var(--color-primary);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.25);
}

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.user-profile-badge {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--bg-selected);
  object-fit: cover;
  border: 2px solid var(--color-primary);
}

.user-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.user-role {
  font-size: 0.75rem;
  color: var(--text-secondary);
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

/* Main Content Area */
.dashboard-main {
  flex-grow: 1;
  margin-left: 280px;
  padding: 32px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

/* Header Navbar for Mobile / Profile action */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}

.mobile-nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.5rem;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-nav-toggle:hover {
  background: var(--bg-element);
}

.panel-title {
  font-weight: 900;
  font-size: 2rem;
  margin: 0;
  letter-spacing: -0.5px;
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
  margin-bottom: 24px;
}

.glass-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.45);
}

.light-theme .glass-card:hover {
  box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.12);
}

/* Auth Pages (Login/Register Card Styling) */
.auth-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 480px;
  background: rgba(28, 37, 65, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transition: all 0.3s ease;
}

.light-theme .auth-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.05);
  box-shadow: 0 20px 50px rgba(31, 38, 135, 0.15);
}

/* Forms & Inputs */
.form-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.form-control, .form-select {
  background-color: rgba(11, 19, 43, 0.5);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 12px;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.light-theme .form-control, .light-theme .form-select {
  background-color: rgba(249, 249, 255, 0.8);
}

.form-control:focus, .form-select:focus {
  background-color: rgba(11, 19, 43, 0.8);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), 0.15);
  color: var(--text-primary);
}

.light-theme .form-control:focus, .light-theme .form-select:focus {
  background-color: #ffffff;
}

.btn-primary-custom {
  background: linear-gradient(135deg, var(--color-primary), #3b82f6);
  border: none;
  color: #ffffff;
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(var(--color-primary-rgb), 0.3);
  transition: all 0.2s ease;
}

.btn-primary-custom:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(var(--color-primary-rgb), 0.45);
}

.btn-primary-custom:disabled {
  background: var(--bg-selected);
  color: var(--text-secondary);
  box-shadow: none;
  transform: none;
}

/* Stats Cards widgets */
.stat-widget {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.stat-info {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  font-weight: 700;
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 900;
  color: var(--text-primary);
  margin: 0;
}

/* Badges for status */
.badge-status {
  padding: 6px 12px;
  border-radius: 20px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-en-attente {
  background-color: rgba(148, 163, 184, 0.15);
  color: #94a3b8;
}

.badge-coupe {
  background-color: rgba(96, 165, 250, 0.15);
  color: #60a5fa;
}

.badge-couture {
  background-color: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-fini {
  background-color: rgba(168, 85, 247, 0.15);
  color: #a855f7;
}

.badge-livre {
  background-color: rgba(52, 211, 153, 0.15);
  color: #34d399;
}

/* Kanban board / pipeline styles */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-top: 24px;
}

.kanban-col {
  background: rgba(11, 19, 43, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: 500px;
}

.light-theme .kanban-col {
  background: rgba(249, 249, 255, 0.75);
}

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

.kanban-title {
  font-weight: 800;
  font-size: 1rem;
  margin: 0;
}

.kanban-count {
  font-size: 0.8rem;
  background: var(--bg-selected);
  color: var(--text-primary);
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
}

.kanban-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-grow: 1;
  overflow-y: auto;
}

.order-card {
  background: var(--bg-element);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.order-card:hover {
  transform: translateY(-2px);
  border-color: var(--color-primary);
}

/* Offline Banner */
.offline-banner {
  background-color: var(--error-color);
  color: #ffffff;
  padding: 10px;
  text-align: center;
  font-weight: 700;
  border-radius: 8px;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Modals & Dialogs */
.modal-content-custom {
  background: var(--bg-element);
  border: 1px solid var(--border-color);
  border-radius: 24px;
  box-shadow: var(--card-shadow);
  color: var(--text-primary);
}

.modal-header-custom {
  border-bottom: 1px solid var(--border-color);
  padding: 20px 24px;
}

.modal-footer-custom {
  border-top: 1px solid var(--border-color);
  padding: 20px 24px;
}

/* Measurements Table / Sheet details */
.dimensions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.dimension-badge {
  background: var(--bg-selected);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.dimension-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  display: block;
}

.dimension-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
}

/* Responsive adjustments */
@media (max-width: 991px) {
  .dashboard-sidebar {
    transform: translateX(-100%);
  }
  
  .dashboard-sidebar.sidebar-open {
    transform: translateX(0);
  }
  
  .dashboard-main {
    margin-left: 0;
    padding: 20px;
  }
  
  .mobile-nav-toggle {
    display: block;
  }
}

/* Quick Type Pills */
.quick-type-pill {
  cursor: pointer;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 20px;
  background: var(--bg-selected) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-color);
  transition: all 0.2s ease;
  user-select: none;
}

.quick-type-pill:hover, .quick-type-pill.active {
  background: var(--color-primary) !important;
  color: #ffffff !important;
  border-color: var(--color-primary);
}
