/* Belal GSM Design System */

:root {
  /* Default Dark Blue Theme */
  --background: #0f172a;
  --foreground: #f8fafc;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --glass-bg: rgba(30, 41, 59, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --danger: #ef4444;
  --success: #10b981;
  --card-bg: rgba(30, 41, 59, 0.4);
}

[data-theme="light"] {
  --background: #f1f5f9;
  --foreground: #0f172a;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --glass-bg: rgba(255, 255, 255, 0.7);
  --glass-border: rgba(0, 0, 0, 0.05);
  --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
  --danger: #dc2626;
  --success: #059669;
  --card-bg: rgba(255, 255, 255, 0.5);
}

[data-theme="purple"] {
  --background: #0f071a;
  --foreground: #f8fafc;
  --primary: #a855f7;
  --primary-hover: #9333ea;
  --glass-bg: rgba(30, 10, 50, 0.6);
  --glass-border: rgba(168, 85, 247, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --danger: #f43f5e;
  --success: #2dd4bf;
  --card-bg: rgba(30, 10, 50, 0.4);
}

[data-theme="emerald"] {
  --background: #061010;
  --foreground: #f0fdf4;
  --primary: #10b981;
  --primary-hover: #059669;
  --glass-bg: rgba(6, 20, 20, 0.7);
  --glass-border: rgba(16, 185, 129, 0.2);
  --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
  --danger: #ef4444;
  --success: #34d399;
  --card-bg: rgba(6, 20, 20, 0.5);
}

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

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
  transition: color 0.2s;
}

/* Glassmorphism */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.2);
}

header.glass {
  position: sticky;
  top: 15px;
  margin: 15px 20px;
  z-index: 1000;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.glass-card {
  padding: 32px;
  animation: slideUp 0.6s ease-out forwards;
}

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

.container.wide {
  max-width: 98%;
  padding: 0 20px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

/* Typography */
.title {
  font-size: 2.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
}

.subtitle {
  color: #94a3b8;
  font-size: 1.1rem;
}

/* Forms */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #94a3b8;
}

input, select, textarea {
  width: 100%;
  padding: 12px 16px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  color: white;
  font-size: 1rem;
  transition: all 0.2s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.3);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: var(--primary);
  color: white;
  text-align: center;
  width: 100%;
  font-size: 1rem;
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -4px rgba(59, 130, 246, 0.5);
}

.btn:active {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--foreground);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--primary);
}

/* Navigation */
.menu-toggle {
  display: none;
}

.nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
}

.nav-brand {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, #fff, var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  transition: opacity 0.2s;
}

.nav-brand:hover {
  opacity: 0.9;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
}

.nav-link:hover {
  color: var(--primary);
}

/* Alerts */
.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

.alert-danger {
  color: var(--danger);
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.alert-success {
  color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

/* Dash Cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  padding: 24px;
  background: var(--card-bg);
}

.stat-label {
  font-size: 0.85rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
}

/* Tables */
.table-container {
  overflow-x: auto;
  margin-top: 24px;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  padding: 16px;
  font-weight: 600;
  color: #94a3b8;
  border-bottom: 1px solid var(--glass-border);
}

td {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
}

tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

/* Badge */
.badge {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-pending { background: rgba(245, 158, 11, 0.1); color: #f59e0b; }
.badge-success { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: #ef4444; }

/* Animations */
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive Design */
@media (max-width: 1024px) {
  .container {
    padding: 15px;
  }
  
  .title {
    font-size: 2rem;
  }
}

@media (max-width: 768px) {
  .nav {
    padding: 12px 16px;
    position: relative;
  }

  header {
    margin: 10px !important;
    position: relative;
    z-index: 99999 !important;
  }

  .nav {
    padding: 0 16px;
    height: 70px;
    position: relative;
    z-index: 999999 !important;
  }

  .nav-links {
    display: none;
    position: fixed;
    top: 85px;
    left: 10px;
    right: 10px;
    flex-direction: row !important; /* Horizontal layout */
    flex-wrap: wrap !important;
    background: rgba(15, 23, 42, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 15px;
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    z-index: 999999 !important;
    gap: 4px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: translateY(-10px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }

  .nav-links.active {
    display: flex !important;
    transform: translateY(0);
    opacity: 1;
  }

  /* Compact Horizontal Switchers on One Line */
  .nav-links div[style*="display: flex"] {
    display: flex !important;
    flex-direction: row !important;
    justify-content: space-between !important;
    width: auto !important; /* Allow side-by-side */
    padding: 5px 10px !important;
    border: 1px solid rgba(255,255,255,0.05) !important;
    border-radius: 20px !important;
    background: rgba(255,255,255,0.02) !important;
    margin-bottom: 5px !important;
  }

  /* Wrap the switcher containers in a row */
  .nav-links {
    display: none;
    flex-wrap: wrap !important;
    justify-content: space-between !important;
    align-items: center !important;
  }

  /* 5 Links in one horizontal line */
  .nav-links > .nav-link {
    display: inline-flex !important;
    flex: 1 1 18% !important; /* Allow 5 items to fit roughly */
    min-width: 0 !important;
    padding: 10px 2px !important;
    justify-content: center !important;
    text-align: center !important;
    font-size: 0.7rem !important;
    font-weight: 600 !important;
    background: rgba(255, 255, 255, 0.03) !important;
    border-radius: 8px !important;
    border: none !important;
    white-space: nowrap !important;
    overflow: hidden !important;
  }

  /* Admin shortcut - Full width below the row */
  .nav-links > a[href*="admin"] {
    flex-basis: 100% !important;
    margin-top: 5px !important;
    background: rgba(59, 130, 246, 0.1) !important;
  }

  .menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    cursor: pointer;
    background: none;
    border: none;
    color: var(--foreground);
    padding: 8px;
    height: 40px;
    width: 40px;
  }

  .menu-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: currentColor;
    margin: 3px 0;
    transition: 0.3s;
  }

  .menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .menu-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  /* Force stack flex containers but EXCLUDE nav and header components */
  div[style*="display: flex"][style*="gap"]:not([style*="justify-content: center"]):not(.nav):not(.user-nav-part),
  div[style*="display: flex"][style*="justify-content: space-between"]:not(.nav) {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 16px !important;
  }
  
  /* Exception for small fixed-width items or nav parts */
  div[style*="gap: 8px"], 
  div[style*="gap: 12px"] {
    flex-direction: row !important;
    align-items: center !important;
  }

  .user-nav-part span {
    order: -1;
    margin-bottom: 8px;
    font-weight: 700;
    color: #fff;
  }

  /* Specific fix for services.php grid */
  div[style*="display: grid"][style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
  }

  /* Sidebar fix */
  div[style*="position: sticky"] {
    position: static !important;
  }

  .glass-card {
    padding: 20px;
  }

  .title {
    font-size: 1.75rem;
  }

  /* Table readability on mobile */
  th, td {
    padding: 12px 8px;
    font-size: 0.85rem;
  }

  .btn {
    width: 100% !important;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 14px;
  }

  .container {
    padding: 10px;
  }

  .btn {
    padding: 10px 16px;
  }
  
  .title {
    font-size: 1.5rem;
  }
}


