/* =========================================
   PREMIUM UI & CINEMATIC ANIMATIONS
   ========================================= */

/* --- Keyframes --- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes glowPulse {
  0% {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
  }
  50% {
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  }
  100% {
    box-shadow: 0 0 5px rgba(255, 215, 0, 0.2);
  }
}

/* --- Global Cinematics --- */
body {
  overflow-x: hidden; /* Prevent horizontal scroll from animations */
}

/* Apply fade-in to main content areas */
.content,
.dashboard-container,
.hub-container {
  animation: fadeInUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Staggered animation for grids (if items have .fade-item class, or we target children) */
/* We can simply assume pages will have a main container that fades in. */

/* --- Card Hover Effects (Global) --- */
.card,
.d-card,
.stat-card,
.section-card {
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) !important;
  position: relative;
  overflow: hidden;
}

.card:hover,
.d-card:hover,
.stat-card:hover,
.section-card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3) !important;
  border-color: rgba(255, 215, 0, 0.4) !important;
}

/* Shine effect on hover */
.card::before,
.d-card::before,
.stat-card::before,
.section-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 50%;
  height: 100%;
  background: linear-gradient(
    to right,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 0.05) 50%,
    rgba(255, 255, 255, 0) 100%
  );
  transform: skewX(-25deg);
  transition: 0.5s;
  pointer-events: none;
}

.card:hover::before,
.d-card:hover::before,
.stat-card:hover::before,
.section-card:hover::before {
  animation: shine 1s;
}

@keyframes shine {
  100% {
    left: 125%;
  }
}

/* --- Table Rows Hover --- */
table tbody tr {
  transition:
    background-color 0.2s,
    transform 0.2s;
}
table tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.03);
  transform: scale(1.005); /* Subtle scale */
  z-index: 10;
  position: relative;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* --- Command Palette (Ctrl+K) --- */
.cmd-palette-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: none; /* Hidden by default */
  align-items: flex-start;
  justify-content: center;
  padding-top: 100px;
}

.cmd-palette-modal {
  background: #1e1e24; /* Dark refined bg */
  border: 1px solid rgba(255, 215, 0, 0.3);
  width: 600px;
  max-width: 90%;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: scaleIn 0.2s ease-out;
}

.cmd-input-wrapper {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.cmd-input-wrapper i {
  color: #888;
  font-size: 1.2rem;
  margin-left: 10px;
}

.cmd-input {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 1.2rem;
  width: 100%;
  outline: none;
  font-family: "Cairo", sans-serif;
}

.cmd-input::placeholder {
  color: #555;
}

.cmd-results {
  max-height: 400px;
  overflow-y: auto;
  padding: 10px 0;
}

.cmd-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: 0.1s;
  color: #ddd;
  text-decoration: none;
}

.cmd-item:hover,
.cmd-item.active {
  background: rgba(255, 255, 255, 0.05);
  border-left-color: var(--gold, #ffd700);
  color: #fff;
}

.cmd-item i {
  width: 25px;
  margin-left: 10px;
  color: #888;
}

.cmd-item:hover i {
  color: var(--gold, #ffd700);
}

.cmd-footer {
  padding: 8px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 0.8rem;
  color: #666;
  display: flex;
  justify-content: space-between;
}

.cmd-key {
  background: #333;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.9em;
  color: #aaa;
}

/* --- Premium Inputs & Select Menus (Fakhame) --- */

select,
input[type="text"],
input[type="number"],
input[type="password"],
textarea,
.premium-input {
  appearance: none !important;
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  padding: 12px 16px !important;
  color: #fff !important;
  font-family: "Cairo", sans-serif !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  backdrop-filter: blur(10px) !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
}

select {
  cursor: pointer !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%23888' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: left 15px center !important;
  padding-left: 40px !important;
}

html[dir="rtl"] select {
  background-position: left 15px center !important;
  padding-left: 40px !important;
  padding-right: 16px !important;
}

select:hover,
input:focus,
textarea:focus,
.premium-input:focus {
  background: rgba(255, 255, 255, 0.05) !important;
  border-color: var(--accent, #ffd700) !important;
  box-shadow:
    0 0 15px rgba(255, 255, 255, 0.05),
    inset 0 2px 4px rgba(0, 0, 0, 0.2) !important;
  outline: none !important;
  transform: translateY(-1px);
}

/* Styling Options Dropdown */
select option {
  background-color: #1a1a1f !important;
  color: #fff !important;
  padding: 12px !important;
}

/* Deadly Mode Adjustments */
body.deadly-theme select,
body.deadly-theme input,
body.deadly-theme textarea,
body.deadly-theme .premium-input {
  background: rgba(255, 0, 0, 0.03) !important;
  border-color: rgba(255, 0, 0, 0.2) !important;
  box-shadow: 0 0 10px rgba(255, 0, 0, 0.1) !important;
  color: #fff !important;
}

body.deadly-theme select:hover,
body.deadly-theme input:focus,
body.deadly-theme .premium-input:focus {
  border-color: #ff0000 !important;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.2) !important;
}

body.deadly-theme select option {
  background-color: #0c0000 !important;
  color: #ff3333 !important;
}

/* Form Labels Premium Style */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  transition: 0.3s;
}

input:focus + label,
select:focus + label {
  color: var(--accent);
}

/* --- Global Select2 Luxury Overrides --- */
.select2-container--default .select2-selection--single {
  background: rgba(255, 255, 255, 0.03) !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
  backdrop-filter: blur(10px) !important;
}

.select2-container--default.select2-container--open .select2-selection--single,
.select2-container--default.select2-container--focus .select2-selection--single {
  border-color: var(--accent, #ffd700) !important;
  box-shadow: 0 0 15px rgba(255, 255, 255, 0.05) !important;
}

.select2-dropdown {
  background: #1a1a1f !important;
  border: 1px solid rgba(255, 255, 255, 0.1) !important;
  border-radius: 12px !important;
  overflow: hidden !important;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8) !important;
  backdrop-filter: blur(20px) !important;
}

.select2-results__option--highlighted[aria-selected] {
  background: rgba(255, 255, 255, 0.05) !important;
  color: var(--accent, #ffd700) !important;
}

/* Deadly Mode Select2 */
body.deadly-theme .select2-container--default .select2-selection--single {
  background: rgba(255, 0, 0, 0.03) !important;
  border-color: rgba(255, 0, 0, 0.2) !important;
}

body.deadly-theme .select2-container--default.select2-container--open .select2-selection--single,
body.deadly-theme .select2-container--default.select2-container--focus .select2-selection--single {
  border-color: #ff0000 !important;
  box-shadow: 0 0 20px rgba(255, 0, 0, 0.2) !important;
}

body.deadly-theme .select2-dropdown {
  background: #0c0000 !important;
  border-color: rgba(255, 0, 0, 0.3) !important;
}

body.deadly-theme .select2-results__option--highlighted[aria-selected] {
  background: rgba(255, 0, 0, 0.1) !important;
  color: #ff3333 !important;
}
