/* ====================================================================
   iSchool Professional Theme Redesign — v2.0
   3 themes: Dark (default), Light, Pink
   Elegant gold accents, ripple effects, click feedback, polished UI
   ==================================================================== */

/* ── CSS Variables ──────────────────────────────────── */
:root {
  --ripple-color: rgba(255, 255, 255, 0.35);
  --btn-active-scale: 0.95;
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --ui-motion: cubic-bezier(0.2, 0.85, 0.25, 1);
  --gold: #c9952e;
  --gold-light: #d4a853;
  --gold-dark: #a0762c;
  --gold-glow: rgba(201, 149, 46, 0.25);
}

/* ── RIPPLE EFFECT CONTAINER ────────────────────────── */
.ripple-btn {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.ripple-btn .ripple-effect {
  position: absolute;
  border-radius: 50%;
  background: var(--ripple-color);
  transform: scale(0);
  animation: rippleAnim 0.5s ease-out forwards;
  pointer-events: none;
  z-index: 1;
}
@keyframes rippleAnim {
  to { transform: scale(4); opacity: 0; }
}

/* ── GLOBAL BUTTON IMPROVEMENTS ─────────────────────── */
button, 
input[type="button"], 
input[type="submit"],
.mini-btn,
.btn-edit,
.btn-enable,
.btn-disable,
.btn-delete,
.mini-btn.green,
.mini-btn.red,
.mini-btn.secondary {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--transition-fast), 
              box-shadow var(--transition-fast), 
              filter var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast) !important;
  user-select: none;
  touch-action: manipulation;
}
button:hover:not(:disabled),
input[type="button"]:hover:not(:disabled),
input[type="submit"]:hover:not(:disabled),
.mini-btn:hover:not(:disabled) {
  filter: brightness(1.08);
}
button:active:not(:disabled),
input[type="button"]:active:not(:disabled),
input[type="submit"]:active:not(:disabled),
.mini-btn:active:not(:disabled),
.btn-edit:active:not(:disabled),
.btn-enable:active:not(:disabled),
.btn-disable:active:not(:disabled),
.btn-delete:active:not(:disabled) {
  transform: scale(var(--btn-active-scale)) !important;
  filter: brightness(0.85);
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.3) !important;
}
button:disabled,
input[type="button"]:disabled,
input[type="submit"]:disabled,
.mini-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── SIDEBAR IMPROVEMENTS ───────────────────────────── */
#sidebarNav a {
  position: relative;
  overflow: hidden;
  transition: transform var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast),
              border-color var(--transition-fast),
              color var(--transition-fast) !important;
  border: 1px solid transparent;
  font-weight: 600;
}
#sidebarNav a:active {
  transform: scale(0.97) !important;
}

/* ── THEME: DARK (DEFAULT) — Elegant Navy + Gold ────── */
body:not(.theme-light){
  --card-bg: rgba(255, 255, 255, 0.88);
  --card-border: rgba(201, 149, 46, 0.25);
  --card-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --text-primary: #f0f4ff;
  --text-secondary: #94a3b8;
  --accent: #c9952e;
  --accent-hover: #d4a853;
  --accent-glow: rgba(201, 149, 46, 0.2);
  --bg-gradient-1: rgba(201, 149, 46, 0.08);
  --bg-gradient-2: rgba(59, 130, 246, 0.10);
  --ripple-color: rgba(255, 215, 120, 0.35);
}
body:not(.theme-light) body{
  background: #ffffff !important;
}

body:not(.theme-light) .mini-btn{
  box-shadow: 0 4px 16px rgba(201, 149, 46, 0.18);
}

body:not(.theme-light) .mini-btn.green{
  background: linear-gradient(135deg, #065f46, #059669);
  box-shadow: 0 4px 16px rgba(5, 150, 105, 0.25);
}

body:not(.theme-light) .mini-btn.red{
  background: linear-gradient(135deg, #991b1b, #dc2626);
  box-shadow: 0 4px 16px rgba(220, 38, 38, 0.25);
}

body:not(.theme-light) .mini-btn.secondary{
  background: rgba(30, 41, 59, 0.8);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.2);
}
body:not(.theme-light) .mini-btn.secondary:hover{
  background: rgba(51, 65, 85, 0.9);
}

/* Dark theme sidebar */
body:not(.theme-light) aside{
  background: rgba(8, 14, 26, 0.95) !important;
  border-color: rgba(201, 149, 46, 0.12) !important;
}

body:not(.theme-light) #sidebarNav a:not(.active):not([aria-current="page"]){
  color: #8899b4 !important;
}

body:not(.theme-light) #sidebarNav a:not(.active):hover{
  background: rgba(201, 149, 46, 0.10) !important;
  color: #d4a853 !important;
  border-color: rgba(201, 149, 46, 0.15) !important;
}

body:not(.theme-light) #sidebarNav a.active, body:not(.theme-light) #sidebarNav a[aria-current="page"]{
  background: linear-gradient(135deg, #8b6624, #c9952e, #d4a853) !important;
  color: #ffffff !important;
  border-color: rgba(212, 168, 83, 0.5) !important;
  box-shadow: 0 4px 20px rgba(201, 149, 46, 0.35), inset 0 1px 0 rgba(255,255,255,0.2) !important;
}

body:not(.theme-light) #sidebarNav a.active::after, body:not(.theme-light) #sidebarNav a[aria-current="page"]::after{
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: #d4a853;
}

/* Dark theme Tailwind utility overrides */
body:not(.theme-light) .text-purple-400, body:not(.theme-light) .text-purple-300{
  color: #c9952e !important;
}
body:not(.theme-light) .bg-purple-950\/40{
  background: rgba(201, 149, 46, 0.15) !important;
}
body:not(.theme-light) .border-purple-800\/50{
  border-color: rgba(212, 168, 83, 0.35) !important;
}
body:not(.theme-light) .bg-purple-600{
  background: linear-gradient(135deg, #a0762c, #c9952e) !important;
}

/* Dark theme cards */
body:not(.theme-light) .neon-border{
  border-color: rgba(201, 149, 46, 0.25) !important;
  box-shadow: 0 0 20px rgba(201, 149, 46, 0.10) !important;
}

/* ── THEME: LIGHT — Clean Professional ──────────────── */
body.theme-light {
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(148, 163, 184, 0.3);
  --card-shadow: 0 8px 30px rgba(15, 23, 42, 0.06);
  --text-primary: #0f172a;
  --text-secondary: #475569;
  --accent: #1a365d;
  --accent-hover: #2563eb;
  --accent-glow: rgba(37, 99, 235, 0.10);
  --bg-gradient-1: rgba(37, 99, 235, 0.05);
  --bg-gradient-2: rgba(5, 150, 105, 0.04);
  --ripple-color: rgba(0, 0, 0, 0.12);
}
body.theme-light {
  background: #eef3f9 !important;
  color: #0f172a !important;
}
body.theme-light aside {
  background: #ffffff !important;
  border-color: #e2e8f0 !important;
}
body.theme-light #sidebarNav a:not(.active):not([aria-current="page"]) {
  color: #475569 !important;
}
body.theme-light #sidebarNav a:not(.active):hover {
  background: rgba(26, 54, 93, 0.06) !important;
  color: #0f172a !important;
}
body.theme-light #sidebarNav a.active,
body.theme-light #sidebarNav a[aria-current="page"] {
  background: linear-gradient(135deg, #1a365d, #2563eb) !important;
  color: #fff !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
  box-shadow: 0 4px 20px rgba(37, 99, 235, 0.25) !important;
}
body.theme-light #sidebarNav a.active::after,
body.theme-light #sidebarNav a[aria-current="page"]::after {
  content: '';
  position: absolute;
  right: -1px;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  border-radius: 0 3px 3px 0;
  background: #93c5fd;
}
body.theme-light .mini-btn {
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
}
body.theme-light .mini-btn.secondary {
  background: #e2e8f0 !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
}
body.theme-light .mini-btn.secondary:hover {
  background: #cbd5e1 !important;
}
/* Light theme Tailwind overrides */
body.theme-light .text-purple-400 {
  color: #1a365d !important;
}
body.theme-light .bg-purple-950\/40 {
  background: rgba(26, 54, 93, 0.08) !important;
}
body.theme-light .bg-purple-600 {
  background: #1a365d !important;
}

/* ── THEME: PINK — Soft Rose + Ivory ────────────── */
/* Pink theme Tailwind overrides */

/* ── GOLD BUTTON (replaces old btn-disable orange) ──── */
.btn-disable {
  background: linear-gradient(135deg, #8b6624, #c9952e) !important;
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(201, 149, 46, 0.3) !important;
  border: 1px solid rgba(212, 168, 83, 0.3) !important;
}
.btn-disable:hover {
  background: linear-gradient(135deg, #a0762c, #d4a853) !important;
  box-shadow: 0 6px 20px rgba(201, 149, 46, 0.4) !important;
}

/* ── CARD / PANEL IMPROVEMENTS ──────────────────────── */
.neon-border,
.account-card,
.family-card,
.salary-box,
.salary-ledger-card,
.comm-message,
.active-user-card {
  transition: transform var(--transition-normal),
              box-shadow var(--transition-normal),
              border-color var(--transition-normal) !important;
}
.neon-border:active,
.account-card:active {
  transform: scale(0.99) !important;
}

/* ── INPUT IMPROVEMENTS ─────────────────────────────── */
input, select, textarea, .inp, .grade-input, .grade-excel-input {
  transition: border-color var(--transition-fast),
              box-shadow var(--transition-fast),
              background var(--transition-fast) !important;
}
input:focus, select:focus, textarea:focus, .inp:focus {
  transform: translateY(0);
}

/* ── MODAL IMPROVEMENTS ─────────────────────────────── */
.family-modal.open {
  animation: modalFadeIn 0.2s ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.family-modal.open > div {
  animation: modalSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* ── TABLE ROW ANIMATION ────────────────────────────── */
table tbody tr {
  transition: background var(--transition-fast), transform var(--transition-fast);
}

/* ── SCROLLBAR STYLING ──────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.4);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb {
  background: rgba(201, 149, 46, 0.35);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(201, 149, 46, 0.55);
}
body.theme-light::-webkit-scrollbar-track {
  background: rgba(226, 232, 240, 0.8);
}
body.theme-light::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.6);
}

/* ── RESPONSIVE SIDEBAR ─────────────────────────────── */
@media (max-width: 768px) {
  aside {
    width: 56px !important;
    min-width: 56px !important;
  }
  aside .p-5 {
    padding: 0.75rem 0.5rem !important;
  }
  aside .flex.items-center.gap-3.mb-7 > span {
    margin: 0 auto;
  }
  aside .flex.items-center.gap-3.mb-7 > div {
    display: none !important;
  }
  #sidebarNav a {
    padding: 0.75rem 0.5rem !important;
    justify-content: center;
  }
  #sidebarNav a span:first-child {
    font-size: 1.25rem;
  }
  #sidebarNav a span:not(:first-child) {
    display: none;
  }
  aside > div:last-child .flex.items-center.gap-2\\.5 {
    justify-content: center;
  }
  aside > div:last-child .flex.items-center.gap-2\\.5 > div:not(:first-child) {
    display: none;
  }
}

/* ── SMALL SCREEN TOUCH IMPROVEMENTS ────────────────── */
@media (hover: none) and (pointer: coarse) {
  button, .mini-btn, #sidebarNav a {
    min-height: 44px;
  }
  .inp, select, textarea {
    font-size: 16px !important;
  }
}

/* ── DROPDOWN MENU IMPROVEMENTS ─────────────────────── */
.period-dropdown-options {
  transform-origin: top right;
  animation: menuPop 0.2s cubic-bezier(0.16, 1, 0.3, 1) both;
}
@keyframes menuPop {
  from { opacity: 0; transform: translateY(-8px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Fix details/summary dropdown toggle for all themes */
.period-dropdown-bar.motion-period-picker summary {
  cursor: pointer !important;
}
.period-dropdown-bar.motion-period-picker details[open] summary:before {
  content: '✕';
}

/* Staff permissions dropdown fix */
.staff-permissions-dropdown-v64 details summary {
  cursor: pointer;
  user-select: none;
  list-style: none;
}
.staff-permissions-dropdown-v64 details summary::-webkit-details-marker {
  display: none;
}

/* ── LOADING STATE ──────────────────────────────────── */
.btn-loading {
  position: relative;
  pointer-events: none;
}
.btn-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  background: inherit;
  border-radius: inherit;
  backdrop-filter: blur(2px);
}
.btn-loading .btn-loading-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.btn-loading .btn-loading-spinner::after {
  content: '';
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

/* ── TOAST / NOTIFICATION ───────────────────────────── */
.toast-notification {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 999999;
  padding: 10px 20px;
  border-radius: 12px;
  direction: rtl;
  font-size: 13px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  pointer-events: none;
}
.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast-notification.success {
  background: #065f46;
  color: #a7f3d0;
  border: 1px solid #059669;
  box-shadow: 0 8px 24px rgba(5, 150, 105, 0.3);
}
.toast-notification.error {
  background: #7f1d1d;
  color: #fecaca;
  border: 1px solid #dc2626;
  box-shadow: 0 8px 24px rgba(220, 38, 38, 0.3);
}
.toast-notification.info {
  background: #1e3a5f;
  color: #bfdbfe;
  border: 1px solid #2563eb;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.3);
}

/* ── PULSE ANIMATION FOR ACTIVE ELEMENTS ────────────── */
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px var(--accent-glow); }
}
.pulse-glow {
  animation: pulse-glow 1.5s ease-in-out infinite;
}

/* ── THEME TOGGLE BUTTON IN SETTINGS ────────────────── */
.theme-toggle-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.theme-toggle-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 2px solid transparent;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  transition: all var(--transition-fast);
  background: rgba(12, 20, 38, 0.6);
  color: #94a3b8;
}
.theme-toggle-btn:hover {
  transform: translateY(-2px);
}
.theme-toggle-btn.active {
  border-color: #c9952e;
  background: rgba(201, 149, 46, 0.15);
  color: #fff;
}
.theme-toggle-btn .theme-color-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
}
body.theme-light .theme-toggle-btn {
  background: #f1f5f9;
  color: #475569;
}
body.theme-light .theme-toggle-btn.active {
  background: rgba(26, 54, 93, 0.10);
  color: #1a365d;
  border-color: #1a365d;
}

/* ── ANIMATIONS ─────────────────────────────────────── */
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── CARD HOVER ELEVATION ──────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .neon-border:hover,
  .account-card:hover,
  .family-card:hover,
  .salary-box:hover,
  .salary-ledger-card:hover,
  .comm-message:hover,
  .active-user-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.18) !important;
  }
}
