/* ==========================================================================
   THE DOCTOR ADMIN - MASTER STYLE (PREMIUM COMPACT EDITION)
   File: assets/css/custom.css
   Description: Core styles, Layout, Navbar, Cards, Forms, Tables & Dark Mode.
   ========================================================================== */

/* 1. GLOBAL VARIABLES & TYPOGRAPHY */
@import url("https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500;700;900&display=swap");

:root {
  /* --- BRAND PALETTE --- */

  /* Primary Color (Action/Success) -> GREEN */
  --primary: #00d894;
  --primary-dark: #00b078;
  --primary-light: rgba(0, 216, 148, 0.15);
  --primary-gradient: linear-gradient(135deg, #00d894 0%, #00b078 100%);

  /* Secondary Color (Info/General) -> BLUE */
  --secondary-brand: #0071bc;
  --secondary-dark: #005a96;
  --secondary-light: rgba(0, 113, 188, 0.15);

  /* Special Status Colors */
  --color-warning: #ff9f43; /* Kept ONLY for 'Waiting' status */
  --color-danger: #ea5455;

  /* --- UI COLORS --- */
  --bg-body: #f4f6f8; /* Soft Gray-Blue */
  --bg-card: #ffffff;
  --text-main: #4b4b4b;
  --text-muted: #b9b9c3;
  --border-color: #ebe9f1;
  --input-bg: #ffffff;

  /* --- SHADOWS --- */
  --shadow-card: 0 4px 18px 0 rgba(34, 41, 47, 0.04);
  --shadow-hover: 0 10px 25px rgba(0, 0, 0, 0.07);
  --shadow-primary: 0 4px 15px rgba(0, 216, 148, 0.3);

  /* --- TRANSITIONS --- */
  --transition: all 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

body {
  font-family: "Roboto", sans-serif !important;
  background-color: var(--bg-body);
  color: var(--text-main);
  /* Reduced font size for "Zoom Out" effect */
  font-size: 0.9rem !important;
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Icon Global Tweaks */
.feather,
[data-feather] {
  stroke-width: 2px !important; /* Thicker strokes */
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Selection Highlight */
::selection {
  background: var(--primary);
  color: #fff;
}

/* ==========================================================================
   2. COLOR UTILITIES & OVERRIDES
   ========================================================================== */

/* Links */
a {
  color: var(--secondary-brand);
  transition: var(--transition);
  text-decoration: none;
}
a:hover {
  color: var(--primary);
}

/* Text Utilities */
.text-primary {
  color: var(--primary) !important;
}
.text-secondary {
  color: var(--secondary-brand) !important;
}
.text-warning {
  color: var(--color-warning) !important;
} /* Orange for Waiting */

/* Backgrounds */
.bg-warning {
  background-color: var(--color-warning) !important;
  color: #fff !important;
}
.border-warning {
  border-color: var(--color-warning) !important;
}

/* Buttons (Compact & Modern) */
.btn {
  border-radius: 8px;
  padding: 0.55rem 1.2rem; /* Compact padding */
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  box-shadow: none !important;
  transition: var(--transition);
}

.btn-primary {
  background: var(--primary-gradient) !important;
  border: none !important;
  box-shadow: var(--shadow-primary) !important;
  color: #fff !important;
}
.btn-primary:hover {
  background-color: var(--primary-dark) !important;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 216, 148, 0.4) !important;
}

/* Warning Button -> Blue (Replaced per request) */
.btn-warning {
  background-color: var(--secondary-brand) !important;
  color: #fff !important;
  border-color: var(--secondary-brand) !important;
}
.btn-warning:hover {
  background-color: var(--secondary-dark) !important;
  border-color: var(--secondary-dark) !important;
  transform: translateY(-2px);
}

/* Badges (Compact) */
.badge {
  padding: 5px 10px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.3px;
}

.badge.badge-light-primary {
  background-color: var(--primary-light) !important;
  color: var(--primary) !important;
}

/* Warning Badge (Kept Orange for Status) */
.badge.badge-light-warning {
  background-color: rgba(255, 159, 67, 0.12) !important;
  color: var(--color-warning) !important;
}

/* Separators */
hr {
  background-color: var(--border-color) !important;
  opacity: 1;
  border: none;
  height: 1px;
}

/* ==========================================================================
   3. HEADER & NAVBAR (COMPACT GLASS)
   ========================================================================== */
.header-navbar {
  min-height: 62px !important; /* Compact height */
  background: rgba(255, 255, 255, 0.85) !important;
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
  border-radius: 0 0 20px 20px;
  margin-bottom: 1.5rem !important;
  padding: 0 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
  z-index: 1001;
}

/* User Info */
.user-nav .user-name {
  font-weight: 700;
  color: var(--text-main);
  font-size: 0.85rem;
  margin-bottom: 0;
}
.user-nav .user-status {
  font-size: 0.7rem;
  color: var(--primary);
  font-weight: 700;
  background: var(--primary-light);
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

/* Smart Avatar */
.avatar-wrapper {
  position: relative;
  cursor: pointer;
  transition: transform 0.2s ease;
  margin-left: 10px;
}
.avatar-wrapper:hover {
  transform: scale(1.05);
}

.avatar-content-box {
  width: 38px;
  height: 38px; /* Compact Size */
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}
.avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
  background: linear-gradient(135deg, var(--primary), var(--secondary-brand));
  color: #fff;
  text-transform: uppercase;
}
.avatar-status-dot {
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 10px;
  height: 10px;
  background-color: #28c76f;
  border: 2px solid #fff;
  border-radius: 50%;
}

/* Dropdown */
.dropdown-user .dropdown-menu {
  border-radius: 12px;
  box-shadow: 0 5px 25px rgba(0, 0, 0, 0.08);
  border: none;
  padding: 6px;
  margin-top: 10px !important;
  animation: slideUpFade 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
}
.dropdown-user .dropdown-item {
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-main);
}
.dropdown-user .dropdown-item:hover {
  background-color: var(--primary-light);
  color: var(--primary);
  transform: translateX(3px);
}
@keyframes slideUpFade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ==========================================================================
   4. DASHBOARD CARDS (FLOATING)
   ========================================================================== */
.card {
  background-color: var(--bg-card);
  border: none;
  border-radius: 14px;
  box-shadow: var(--shadow-card);
  transition: var(--transition);
  margin-bottom: 1.5rem;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.card .card-header {
  background-color: transparent !important;
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 1.2rem;
}
.card .card-header .card-title,
.content-header-title {
  font-weight: 800;
  color: var(--secondary-brand);
  font-size: 1.05rem;
  letter-spacing: -0.5px;
}
.content-header-title {
  border-right-color: var(--secondary-brand) !important;
}

/* Stat Cards */
.card-statistics .avatar {
  background-color: rgba(243, 244, 246, 1);
  border-radius: 10px;
  width: 42px;
  height: 42px;
}
.card-statistics h4.fw-bolder {
  font-size: 1.5rem;
  color: #2c2c2c;
  margin-bottom: 0.2rem;
  letter-spacing: -0.5px;
}
.card-statistics .card-text {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  text-transform: uppercase;
}

/* PREMIUM WELCOME CARD (Bienvenue) */
.card-congratulation-medal {
  /* Rich Gradient: Deep Blue to Cyan to Green */
  background: linear-gradient(
    135deg,
    #005a96 0%,
    #0071bc 50%,
    #00d894 100%
  ) !important;
  position: relative;
  overflow: hidden;
  border: none;
  box-shadow: 0 10px 30px -5px rgba(0, 113, 188, 0.4) !important;
  color: #fff;
}

/* Decorative Circles */
.card-congratulation-medal::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -50px;
  width: 200px;
  height: 200px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.15) 0%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
}
.card-congratulation-medal::after {
  content: "";
  position: absolute;
  bottom: -30px;
  left: -30px;
  width: 150px;
  height: 150px;
  background: radial-gradient(
    circle,
    rgba(255, 255, 255, 0.1) 0%,
    transparent 70%
  );
  border-radius: 50%;
  pointer-events: none;
}

/* Text */
.card-congratulation-medal h5 {
  color: #fff !important;
  font-weight: 800;
  font-size: 1.4rem;
  margin-bottom: 0.5rem;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.card-congratulation-medal .card-text {
  color: rgba(255, 255, 255, 0.9) !important;
  font-size: 0.9rem !important;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}
.card-congratulation-medal h3 a {
  color: #fff !important;
  font-size: 2.2rem;
  font-weight: 900;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  display: inline-block;
  margin-top: 5px;
}

/* Button inside Card */
.card-congratulation-medal .btn-primary {
  background-color: #fff !important;
  color: #0071bc !important;
  border: none !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
  font-weight: 700;
  margin-top: 15px;
}
.card-congratulation-medal .btn-primary:hover {
  background-color: #f8f9fa !important;
  transform: translateY(-2px);
}

/* ==========================================================================
   5. FORMS & INPUTS (COMPACT)
   ========================================================================== */
.form-control,
.form-select,
.input-group-text {
  background-color: var(--input-bg);
  border: 1px solid #d8d6de;
  border-radius: 8px;
  padding: 0.5rem 0.85rem;
  font-size: 0.9rem;
  transition: var(--transition);
  min-height: 38px;
}
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
  background-color: #fff;
}
.form-label {
  font-weight: 600;
  color: var(--text-main);
  font-size: 0.85rem;
  margin-bottom: 0.3rem;
}

/* Checkbox */
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}

/* ==========================================================================
   6. TABLES & DATATABLES
   ========================================================================== */
.table {
  border-collapse: separate;
  border-spacing: 0 4px;
}

.table thead th {
  background-color: #fafbfc;
  color: var(--secondary-brand) !important;
  font-weight: 800 !important;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  padding: 0.8rem 1rem;
  border: none;
}

.table tbody tr {
  background-color: var(--bg-card);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.02);
  transition: transform 0.2s ease;
}

.table tbody td {
  padding: 0.8rem 1rem;
  vertical-align: middle;
  border: none;
  font-weight: 500;
  color: var(--text-main);
  font-size: 0.9rem;
}

.table tbody tr:first-child td:first-child {
  border-top-left-radius: 8px;
}
.table tbody tr:first-child td:last-child {
  border-top-right-radius: 8px;
}
.table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 8px;
}
.table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 8px;
}

.table-hover tbody tr:hover {
  transform: scale(1.002);
  background-color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  z-index: 2;
  position: relative;
}

/* Pagination */
.page-item .page-link {
  border-radius: 50%;
  margin: 0 3px;
  border: none;
  font-weight: 600;
  color: var(--text-main);
}
.page-item.active .page-link {
  background-color: var(--primary) !important;
  border-color: var(--primary) !important;
  box-shadow: var(--shadow-primary);
  color: #fff !important;
}

/* ==========================================================================
   7. DARK MODE OVERRIDES (FULL SUITE)
   ========================================================================== */
html.dark-layout body {
  background-color: #161d31;
  color: #d0d2d6;
}

/* Navbar */
html.dark-layout .header-navbar {
  background: rgba(40, 48, 70, 0.85) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
html.dark-layout .avatar-status-dot {
  border-color: #283046;
}

/* Cards */
html.dark-layout .card {
  background-color: #283046;
  box-shadow: 0 4px 20px 0 rgba(0, 0, 0, 0.2);
}
html.dark-layout .card .card-header {
  border-bottom-color: #3b4253;
}
html.dark-layout .card .card-title {
  color: #d0d2d6 !important;
}
html.dark-layout .card-statistics h4.fw-bolder {
  color: #e6e6e6;
}

/* Forms */
html.dark-layout .form-control,
html.dark-layout .form-select,
html.dark-layout .input-group-text {
  background-color: #283046;
  border-color: #3b4253;
  color: #d0d2d6;
}
html.dark-layout .form-control:focus {
  border-color: var(--primary);
  background-color: #161d31;
}
html.dark-layout .form-label {
  color: #b4b7bd;
}

/* Tables */
html.dark-layout .table tbody tr {
  background-color: #283046;
}
html.dark-layout .table thead th {
  background-color: #343d55;
  color: #b4b7bd !important;
}
html.dark-layout .table-hover tbody tr:hover {
  background-color: #343d55;
}

/* Dropdowns & Modals */
html.dark-layout .modal-content,
html.dark-layout .dropdown-menu {
  background-color: #283046;
  border: 1px solid #3b4253;
}
html.dark-layout .dropdown-item {
  color: #d0d2d6;
}
html.dark-layout .dropdown-item:hover {
  background-color: rgba(255, 255, 255, 0.05);
}
html.dark-layout .modal-header .btn-close {
  filter: invert(1) grayscale(100%) brightness(200%);
}

/* Colors Override */
html.dark-layout .text-warning {
  color: #ff9f43 !important;
}
html.dark-layout .badge.badge-light-warning {
  background-color: rgba(255, 159, 67, 0.15) !important;
  color: #ff9f43 !important;
}

/* Scrollbars */
html.dark-layout ::-webkit-scrollbar-thumb {
  background: #4b5563;
}
html.dark-layout ::-webkit-scrollbar-track {
  background: transparent;
}

/* ==========================================================================
   8. DROPDOWN FIX (CRITICAL)
   ========================================================================== */

/* 1. Force the menu to show when the class is added */
.header-navbar .dropdown-menu.show {
  display: block !important;
  opacity: 1 !important;
  visibility: visible !important;
  transform: translateY(0) !important;
  top: 100% !important;
  margin-top: 0.5rem !important;
  pointer-events: auto !important;
}

/* 2. Remove default transitions that might hide it */
.header-navbar .dropdown-menu {
  transition: none !important;
}

/* 3. Ensure high z-index so it appears above other elements */
.header-navbar .dropdown-user .dropdown-menu {
  z-index: 1050 !important;
  min-width: 14rem;
}

/* 4. Fix for arrow icon alignment inside the link */
.dropdown-user-link {
  display: flex;
  align-items: center;
}

/* ==========================================================================
   DATATABLES SCROLL FIX (UPDATED)
   ========================================================================== */

/* 1. Force container width */
.dataTables_wrapper {
  width: 100%;
}

/* 2. Force header width */
.dataTables_scrollHeadInner {
  width: 100% !important;
  padding-right: 0 !important;
}

/* 3. Force table width */
table.dataTable {
  width: 100% !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* 4. Scrollbar styling */
.dataTables_scrollBody::-webkit-scrollbar {
  height: 12px;
}
.dataTables_scrollBody::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 10px;
}
.dataTables_scrollBody::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}
.dataTables_scrollBody::-webkit-scrollbar-track {
  background: #f1f1f1;
}

h1,
h2,
h3,
h4,
h5,
h6,
.navigation,
.header-navbar,
.btn,
input,
select,
textarea,
.main-menu .navigation > li > a {
  font-family: "Roboto", sans-serif !important;
}

/* ==========================================================================
   DATATABLES HEADER FIX
   ========================================================================== */
table.dataTable thead th,
table.dataTable thead td {
  white-space: nowrap !important; /* يمنع النص من النزول لسطر جديد */
  padding-right: 30px !important; /* مساحة لأيقونة الترتيب */
  vertical-align: middle !important;
}

table.dataTable {
  width: 100% !important;
  margin-top: 0 !important;
}

/* تحسين مظهر التبويبات */
.nav-tabs .nav-link {
  font-weight: 600;
  color: #5e5873;
}
.nav-tabs .nav-link.active {
  color: #7367f0 !important; /* لون البراند */
}

.above {
  z-index: 9999;
}
