/* =====================================================
   VOD CRM – THE DARK MATTER UX
   "Elegant, Dark, Comfortable, Royal"
   Responsive, High-Fidelity Design System
   Adapted for Legal CRM Environment
===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;600;700;800;900&family=Inter:wght@400;500;600;700&family=Tajawal:wght@400;500;700&display=swap');

:root {
  /* Rakiz Official Palette */
  --bg-dark: #0a1128;
  --text-light: #ffffff;
  --primary-color: #ffffff;
  --glass-bg: rgba(255, 255, 255, 0.005);
  --glass-border: rgba(255, 255, 255, 0.06);
  --text-muted: #94a3b8;
  --glow-blue: 0 10px 30px rgba(255, 255, 255, 0.05);
  
  --panel: var(--glass-bg);
  --panel-stroke: var(--glass-border);

  --text-main: var(--text-light);
  --text-dim: var(--text-muted);
  
  --font-ar: 'Cairo', sans-serif;
  
  --sidebar-width: 280px;
  --header-height: 80px;
  
  --transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  --dur: 400ms;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 16px; overflow-x: hidden; }

body {
  margin: 0; padding: 0;
  background-color: var(--bg-dark);
  color: var(--text-main);
  font-family: var(--font-ar);
  line-height: 1.8;
  overflow-x: hidden;
  position: relative;
  min-height: 100vh;
}

/* Pulsing Watermark Fixed Logo */
body::before {
    content: '';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(400px, 80vw);
    height: min(400px, 80vw);
    background-image: url('../images/logo_rakiz.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.08;
    z-index: -1;
    animation: pulseLogo 6s ease-in-out infinite;
    filter: brightness(10) contrast(1.2);
}

/* Background Image behind Watermark */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/bg_rakiz.png');
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.1;
    z-index: -2;
    filter: contrast(0.7);
}

@keyframes pulseLogo {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.03; }
    50% { transform: translate(-50%, -50%) scale(1.12); opacity: 0.08; }
}

/* ================== THE CUSTOM BACKGROUND & SPOTLIGHT ================== */
/* Spotlight removed to match Rakiz style */
.aurora-bg, .spotlight {
    display: none;
}

/* ================== LAYOUT STRUCTURE ================== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  direction: rtl;
  overflow-x: hidden;
  position: relative;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: rgba(10, 17, 40, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-left: 1px solid var(--panel-stroke);
  height: 100vh;
  position: fixed;
  right: 0; top: 0;
  z-index: 1000;
  padding: 30px 20px;
  overflow-y: auto;
  transition: right 0.4s var(--ease), background 0.4s var(--ease);
}

.main-content {
  margin-right: var(--sidebar-width);
  flex: 1;
  padding: 40px;
  min-height: 100vh;
  transition: margin 0.4s var(--ease);
}

/* ================== COMPACT MOBILE DESIGN ================== */
/* Tablets & Small Laptops */
@media (max-width: 1024px) {
  .sidebar {
    right: -280px; /* Foolproof hiding off-screen */
    background: rgba(10, 10, 15, 0.98); /* Solid background to prevent text overlap */
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
  }
  .sidebar.active {
    right: 0;
    box-shadow: -10px 0 50px rgba(0,0,0,0.8);
  }
  .main-content {
    margin-right: 0;
    padding: 20px;
    width: 100%;
    overflow-x: hidden;
  }
}

/* Mobile Phones - Compact Mode (Desktop feel, scaled down) */
@media (max-width: 768px) {
  /* Show Hamburger Menu */
  #sidebarToggle {
    display: block !important;
  }
  
  /* Compact Header */
  header {
    margin-bottom: 20px !important;
    gap: 15px !important;
    flex-wrap: wrap !important; /* Allow header to wrap if items are too wide */
  }
  
  header > div {
    flex-wrap: wrap !important;
  }
  
  .page-title {
    font-size: 1.2rem !important;
  }

  /* Compact Cards */
  .dm-card {
    padding: 15px !important;
  }

  /* Compact Buttons (Inline, Not 100%) */
  .btn-premium, button, .btn {
    padding: 8px 16px !important;
    font-size: 0.85rem !important;
    gap: 6px !important;
    display: inline-flex !important; /* Force inline so they don't stretch */
    width: auto !important; /* Never stretch to 100% width */
    justify-content: center;
  }

  /* Compact Inputs */
  input:not([type="checkbox"]):not([type="radio"]), 
  select, 
  textarea {
    padding: 8px 14px !important;
    font-size: 0.9rem !important;
  }
  
  label {
    font-size: 0.95rem !important;
    margin-bottom: 6px !important;
  }

  /* Stats Grid: Side-by-side but smaller */
  .stats-grid {
    gap: 12px !important;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)) !important;
    margin-bottom: 25px !important;
  }
  
  .stat-card {
    padding: 15px !important;
  }

  .stat-value {
    font-size: 1.5rem !important;
    margin: 5px 0 !important;
  }

  /* Responsive Horizontal Scrolling Tables */
  table {
    display: block !important;
    width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }
  
  th, td {
    padding: 10px !important;
    font-size: 0.85rem !important;
    white-space: nowrap !important;
  }
  
  /* Top Right Profile/Search grouping */
  #globalSearch {
    width: 140px !important;
  }
}

/* ================== PREMIUM COMPONENTS ================== */

/* Cards (The DM Card) */
.dm-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  padding: 30px;
  position: relative;
  transition: var(--transition);
  overflow: hidden;
}

.dm-card:hover {
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: var(--glow-blue);
    transform: translateY(-5px);
}

/* Buttons */
.btn-premium {
  background: rgba(255, 255, 255, 0.05);
  color: white !important;
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 14px 32px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-decoration: none;
  backdrop-filter: blur(10px);
}

.btn-premium:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: white;
  transform: translateY(-2px);
  box-shadow: var(--glow-blue);
}

.btn-premium i {
    color: white !important;
}

/* Navigation Links */
.nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  color: var(--text-dim);
  text-decoration: none;
  border-radius: 14px;
  margin-bottom: 8px;
  transition: 0.3s;
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,0.08);
  color: white;
}

.nav-link i {
  font-size: 1.1rem;
  width: 24px;
  text-align: center;
  color: var(--primary-color);
}

/* ================== FORMS & INPUTS (Premium Fix) ================== */
.dm-input, 
input:not([type="checkbox"]):not([type="radio"]), 
select, 
textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid var(--panel-stroke) !important;
  border-radius: 12px !important;
  padding: 14px 45px 14px 15px !important; /* Fixed padding for RTL Icons */
  color: #fff !important;
  font-family: var(--font-ar) !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  outline: none !important;
  transition: all 0.3s var(--ease) !important;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.2) !important;
  position: relative;
}

/* Hide Browser Default Icons (Chrome/Edge/Safari) */
input::-webkit-calendar-picker-indicator,
input::-webkit-inner-spin-button,
input::-webkit-clear-button {
  display: none !important;
  -webkit-appearance: none !important;
}

/* Global Icon Positioning for Inputs */
.input-with-icon {
  position: relative;
  width: 100%;
}

.input-with-icon i, 
.form-group i {
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color) !important;
  font-size: 1.1rem;
  z-index: 5;
  pointer-events: none;
  opacity: 0.8;
}

/* Premium Select Styling */
select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%234f46e5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: left 15px center !important; /* Arrow on the left for RTL */
  cursor: pointer;
}

select option {
  background: #0d0d12 !important;
  color: #fff !important;
  padding: 15px !important;
}

/* Focus States */
input:focus, select:focus, textarea:focus {
  border-color: var(--primary-color) !important;
  background: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.15) !important;
}

/* Specific Fix for Search Bars (DataTables etc) */
.dataTables_filter input, 
#globalSearch, 
.search-input {
  padding-right: 40px !important;
  background-image: none !important;
}

/* Icon for search specifically */
.search-wrapper {
  position: relative;
}
.search-wrapper::after {
  content: "\f002";
  font-family: "Font Awesome 6 Free";
  font-weight: 900;
  position: absolute;
  right: 15px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  opacity: 0.7;
}

label {
  display: block;
  margin-bottom: 10px;
  color: #efefff;
  font-weight: 700;
  font-size: 0.95rem;
  opacity: 0.9;
}

/* Spacing and Grouping */
.form-group {
  margin-bottom: 25px;
}

/* Buttons Polish */
.btn-premium {
  padding: 14px 32px;
  font-size: 1rem;
  letter-spacing: 0.5px;
}

/* ================== ANIMATIONS ================== */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.8s var(--ease);
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Statistics Cards Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 25px;
  margin-bottom: 40px;
}

.stat-card {
  padding: 25px;
  text-align: center;
}

.stat-value {
  font-size: 2.2rem;
  font-weight: 900;
  margin: 10px 0;
  color: white;
}

.stat-label {
  color: var(--text-dim);
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Custom Icon Engine Support */
.dm-icon-box {
  width: 60px;
  height: 60px;
  background: rgba(79, 70, 229, 0.1);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.dm-icon-box i {
  font-size: 1.5rem;
  color: var(--primary-color);
}

/* ================== PREMIUM CHECKBOXES (Standardized) ================== */
.dm-checkbox-label {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  color: white !important;
  cursor: pointer !important;
  font-size: 0.95rem !important;
  font-weight: 600 !important;
  transition: all 0.2s var(--ease) !important;
  padding: 8px 14px !important;
  border-radius: 12px !important;
  margin-bottom: 5px !important;
  user-select: none;
}

.dm-checkbox-label:hover {
  background: rgba(255, 255, 255, 0.05) !important;
  transform: translateX(-5px);
}

.dm-checkbox {
  width: 22px !important;
  height: 22px !important;
  accent-color: var(--primary-color) !important;
  cursor: pointer !important;
  margin: 0 !important;
  flex-shrink: 0;
}

/* Green Variant (Excel/Success) */
.dm-checkbox-label.green .dm-checkbox {
  accent-color: #2ecc71 !important;
}

/* Gold/Admin Variant */
.dm-checkbox-label.gold .dm-checkbox {
  accent-color: var(--accent-gold) !important;
}
