/* =====================================================================
   Premium Shared Design System – TheSyndic / Arkendia
   v21 – Cool Blue Glass: unified glassmorphism design
   ===================================================================== */

/* ---- Google Fonts (DM Sans) ---- */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&display=swap');

:root {
  --sidebar-width: 260px;
  --sidebar-gap: 0px;
  --sidebar-total: var(--sidebar-width);
  --container-max: 1260px;
  --gutter: 28px;

  /* Palette – Cool Blue Glass */
  --border: rgba(91,106,245,0.12);
  --border-light: rgba(91,106,245,0.08);
  --heading: #0F172A;
  --text: #334155;
  --muted: #94A3B8;
  --accent: #5B6AF5;
  --accent-hover: #4550E0;
  --accent-light: rgba(91,106,245,0.10);
  --surface: rgba(245,248,255,0.50);
  --surface-raised: rgba(245,248,255,0.38);
  --background: #F0F4FF;

  /* Premium Liquid Glass – cool blue */
  --glass-bg: rgba(245,248,255,0.55);
  --glass-card: rgba(245,248,255,0.55);
  --glass-card-hover: rgba(245,248,255,0.68);
  --glass-border: rgba(240,245,255,0.55);
  --glass-blur: blur(24px) saturate(160%);
  --card-radius: 20px;
  --card-border: 1px solid var(--glass-border);
  --card-shadow: none;
  --glass-shadow: none;
  --glass-highlight: none;
  --glass-refraction: none;

  /* Shadows – warm layered depth */
  --shadow-xs: none;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
  --shadow-xl: none;

  /* Radii */
  --radius-sm: 14px;
  --radius-md: 18px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  /* Motion – buttery smooth */
  --transition: all 0.32s cubic-bezier(0.22, 1, 0.36, 1);
  --transition-fast: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  --spring: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Base: subtle pastel mesh background ── */
html {
  height: 100%;
  overflow: hidden;
}
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(ellipse 80% 65% at 5% 10%, rgba(165,180,252,0.35), transparent 50%),
    radial-gradient(ellipse 75% 60% at 95% 15%, rgba(147,197,253,0.30), transparent 50%),
    radial-gradient(ellipse 70% 55% at 80% 85%, rgba(196,181,253,0.28), transparent 50%),
    radial-gradient(ellipse 65% 50% at 15% 80%, rgba(134,239,172,0.18), transparent 45%),
    radial-gradient(ellipse 55% 40% at 50% 45%, rgba(253,186,116,0.12), transparent 40%),
    linear-gradient(160deg, #F0F4FF 0%, #EBF0FF 25%, #E8E0F0 50%, #F0F7FF 75%, #F5F0FF 100%) !important;
  background-attachment: fixed !important;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Subtle ambient glass overlay ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.08);
  backdrop-filter: blur(60px) saturate(120%);
  -webkit-backdrop-filter: blur(60px) saturate(120%);
  border-radius: 0;
  border: none;
  box-shadow: none;
  z-index: 1;
  pointer-events: none;
}

/* Noise texture for photorealistic glass */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
  mix-blend-mode: overlay;
}

.page-bg, .bg-mesh, .bg-orb { display: none; }

/* ── Ultra Premium scrollbar ── */
.index-content::-webkit-scrollbar { width: 7px; }
.index-content::-webkit-scrollbar-track { background: transparent; margin: 20px 0; }
.index-content::-webkit-scrollbar-thumb { background: rgba(91,106,245,0.12); border-radius: 10px; border: 1.5px solid transparent; background-clip: content-box; transition: background 0.3s; }
.index-content::-webkit-scrollbar-thumb:hover { background: rgba(91,106,245,0.22); border: 1.5px solid transparent; background-clip: content-box; }
.index-content { scrollbar-width: thin; scrollbar-color: rgba(91,106,245,0.12) transparent; }

/* ── Content wrapper: fixed edge-to-edge ── */
.index-content {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: var(--sidebar-total);
  z-index: 2;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: auto;
  box-sizing: border-box;
  background: transparent;
  border-left: none;
  border-radius: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

/* Topbar: integrated into surface */
.index-content > .desktop-topbar {
  width: 100%;
  margin-bottom: 0;
  flex-shrink: 0;
}

.container, .grid {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

/* ---- Section cards — Ultra Premium Liquid Glass ---- */
.modern-section {
  background: var(--glass-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  padding: 24px;
  margin-bottom: 20px;
  border: var(--card-border);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  scroll-margin-top: 100px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
  width: 100%;
}

.modern-section::before { display: none; }

.modern-section::after { display: none; }

.modern-section:hover {
  box-shadow: var(--card-shadow);
  background: var(--glass-card-hover);
  border-color: rgba(240,245,255,0.65);
}

/* ---- Section header ---- */
.section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  padding: 0;
  position: relative;
}

.section-header .section-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: rgba(91,106,245,0.10);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 16px;
  box-shadow: none;
  border: 1px solid rgba(91,106,245,0.10);
  flex-shrink: 0;
}

.section-header h4 {
  margin: 0;
  font-weight: 700;
  color: var(--heading);
  font-size: 20px;
  letter-spacing: -0.02em;
}

.page-title {
  font-weight: 800;
  margin: 0 0 24px 0;
  color: var(--heading);
  font-size: 28px;
  text-align: left;
  letter-spacing: -0.02em;
  width: 100%;
  align-self: flex-start;
}

/* ---- Buttons – Ultra Premium Glass ---- */
.btn-modern {
  background: linear-gradient(135deg, #5B6AF5 0%, #818CF8 100%);
  color: #fff;
  border: none;
  padding: 11px 22px;
  border-radius: 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--spring);
  box-shadow:
    0 2px 8px rgba(91,106,245,0.22),
    0 8px 24px rgba(91,106,245,0.12),
    inset 0 1px 0 rgba(255,255,255,0.30),
    inset 0 -1px 0 rgba(0,0,0,0.08);
  text-decoration: none;
  display: inline-block;
  font-family: 'DM Sans', -apple-system, sans-serif;
  position: relative;
  overflow: hidden;
}

.btn-modern::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transition: left 0.5s ease;
}

.btn-modern:hover::before {
  left: 100%;
}

.btn-modern:hover {
  color: #fff;
  text-decoration: none;
  transform: translateY(-3px) scale(1.02);
  box-shadow:
    0 6px 20px rgba(91,106,245,0.28),
    0 12px 40px rgba(91,106,245,0.16),
    inset 0 1px 0 rgba(255,255,255,0.35),
    inset 0 -1px 0 rgba(0,0,0,0.08);
  background: linear-gradient(135deg, #4550E0 0%, #5B6AF5 100%);
}

.btn-modern.btn-secondary {
  background: rgba(245,248,255,0.38);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  color: var(--text);
  box-shadow:
    0 2px 8px rgba(15,23,42,0.04),
    inset 0 1px 0 rgba(245,248,255,0.60),
    inset 0 -1px 0 rgba(245,248,255,0.18);
  border: 1px solid rgba(240,245,255,0.55);
}

.btn-modern.btn-secondary::before { display: none; }

.btn-modern.btn-secondary:hover {
  background: rgba(245,248,255,0.52);
  box-shadow:
    0 6px 20px rgba(15,23,42,0.06),
    inset 0 1px 0 rgba(245,248,255,0.70),
    inset 0 -1px 0 rgba(245,248,255,0.20);
  transform: translateY(-1px);
}

/* ---- Document rows – Glass ---- */
.year-header {
  background: rgba(91,106,245,0.08);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  margin: 14px 0 10px;
  color: var(--accent);
  border: 1px solid rgba(91,106,245,0.12);
  position: relative;
  overflow: hidden;
  font-size: 13px;
  letter-spacing: 0.3px;
  box-shadow: inset 0 1px 0 rgba(245,248,255,0.45);
}

.year-header::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: linear-gradient(180deg, #5B6AF5, #4550E0);
  border-radius: 0 2px 2px 0;
}

.document-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(240,245,255,0.22);
  transition: var(--transition);
  border-radius: var(--radius-sm);
  margin-bottom: 2px;
}

.document-item:hover {
  background: rgba(245,248,255,0.30);
  transform: translateX(3px);
  box-shadow: inset 0 1px 0 rgba(245,248,255,0.40);
}

.doc-date {
  background: rgba(91,106,245,0.10);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: var(--accent);
  border-radius: 10px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  border: 1px solid rgba(91,106,245,0.10);
  box-shadow: inset 0 1px 0 rgba(245,248,255,0.40);
}

.doc-name {
  font-size: 14px;
  color: #333;
  font-weight: 500;
  flex: 1 1 auto;
  text-decoration: none;
}

/* ---- Quota bar – Glass ---- */
.quota-bar {
  background: rgba(245,248,255,0.22);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-radius: 10px;
  height: 12px;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 1px 2px rgba(15,23,42,0.04), inset 0 -1px 0 rgba(245,248,255,0.25);
  border: 1px solid rgba(240,245,255,0.35);
}

.quota-fill {
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
  transition: all 0.5s ease;
  position: relative;
  overflow: hidden;
}

.quota-fill.warning { background: linear-gradient(135deg, #ffc107 0%, #fd7e14 100%); }
.quota-fill.danger { background: linear-gradient(135deg, #dc3545 0%, #c82333 100%); }
.quota-fill::before {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 100%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  animation: shimmer 2s infinite;
}
@keyframes shimmer { 0%{left:-100%;} 100%{left:100%;} }

/* ---- Alerts – Glass ---- */
.alert {
  border-radius: 16px;
  border: 1px solid rgba(240,245,255,0.40);
  padding: 14px 18px;
  margin: 10px 0;
  font-weight: 500;
  font-size: 14px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: inset 0 1px 0 rgba(245,248,255,0.50);
}

.alert-success {
  background: rgba(40,167,69,0.10);
  color: #155724;
  border-left: 3px solid #28a745;
}

.alert-danger {
  background: rgba(220,53,69,0.10);
  color: #721c24;
  border-left: 3px solid #dc3545;
}

/* ---- Forms global reset ---- */
input, select, textarea, button {
  font-family: 'DM Sans', -apple-system, sans-serif;
}

/* ---- Responsive ---- */
@media (max-width: 1100px) { .grid { padding: 0; } }

/* ══════════════════════════════════════════════════
   Premium Glass Modal – Global Styles
   ══════════════════════════════════════════════════ */
.modal {
    position: fixed !important; top: 0; left: 0; right: 0; bottom: 0;
    width: 100% !important; height: 100% !important;
    display: flex !important; align-items: flex-start; justify-content: center;
    background: rgba(17,24,39,0.45);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    z-index: 10000; padding: 40px 20px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.25s ease, visibility 0s linear 0.25s;
}
.modal.fade.in, .modal.show {
    opacity: 1; visibility: visible; pointer-events: auto;
    transition: opacity 0.25s ease, visibility 0s linear 0s;
}
.modal-dialog { margin: auto !important; width: 92%; max-width: 480px; position: relative; left: auto !important; top: auto !important; transform: none !important; display: block; flex-shrink: 0; }
.modal-dialog.modal-lg { max-width: 720px; }
.modal-backdrop { display: none !important; }
@media (max-width:600px) { .modal-dialog { width: 100%; } }

/* Sidebar + header dimmed state (toggled via JS) */
.index-sidebar.modal-dimmed {
    opacity: 0.25 !important;
    pointer-events: none !important;
    transition: opacity 0.25s ease !important;
}
header.modal-dimmed {
    filter: blur(16px) brightness(0.5) !important;
    pointer-events: none !important;
    transition: filter 0.25s ease !important;
}

/* Modal content – glass card */
.modal-content {
    border-radius: 20px; border: 1px solid rgba(91,106,245,0.10);
    box-shadow: 0 24px 80px rgba(15,23,42,0.15), 0 0 0 1px rgba(91,106,245,0.06);
    background: linear-gradient(160deg, rgba(245,248,255,0.96) 0%, rgba(240,245,255,0.94) 100%);
    backdrop-filter: blur(24px) saturate(160%); -webkit-backdrop-filter: blur(24px) saturate(160%);
    animation: premiumModalIn 0.25s ease-out; position: relative; z-index: 1051; overflow: visible;
}
@keyframes premiumModalIn { from { opacity: 0; transform: scale(0.95) translateY(-10px); } to { opacity: 1; transform: scale(1) translateY(0); } }

/* Modal header */
.modal-header {
    background: linear-gradient(135deg, rgba(91,106,245,0.08) 0%, rgba(91,106,245,0.04) 100%);
    color: #0F172A; border-bottom: 1px solid rgba(91,106,245,0.08);
    padding: 22px 24px; border-radius: 20px 20px 0 0; position: relative;
}
.modal-title { font-weight: 800; font-size: 17px; margin: 0; color: #0F172A; font-family: 'DM Sans', sans-serif; letter-spacing: -0.01em; }
.modal-title::before { content: ''; display: inline-block; width: 4px; height: 18px; background: linear-gradient(180deg, #5B6AF5, #818CF8); border-radius: 4px; margin-right: 10px; vertical-align: middle; }
.modal-header .close,
.modal-header .btn-close { color: #94A3B8; opacity: 0.7; font-size: 22px; text-shadow: none; background: none; border: none; position: absolute; top: 18px; right: 20px; cursor: pointer; z-index: 1052; transition: all 0.2s; }
.modal-header .close:hover,
.modal-header .btn-close:hover { opacity: 1; color: #0F172A; }

/* Modal body + footer */
.modal-body { padding: 24px; background: transparent; }
.modal-body form { margin: 0; }
.modal-footer { background: rgba(91,106,245,0.03); border-top: 1px solid rgba(91,106,245,0.06); padding: 14px 24px; border-radius: 0 0 20px 20px; }
.modal-footer .btn { min-width: 120px; }

/* Modal form elements */
.modal .form-group { margin-bottom: 18px; display: block; }
.modal .form-group label { font-size: 12px; letter-spacing: .3px; text-transform: uppercase; color: #94A3B8; font-weight: 600; display: block; margin-bottom: 6px; flex: none; }
.modal .form-control { font-size: 14px; height: auto; line-height: 1.4; border: 1px solid rgba(91,106,245,0.10); border-radius: 12px; padding: 11px 14px; background: rgba(245,248,255,0.80); transition: all 0.2s ease; margin-bottom: 14px; width: 100%; font-family: 'DM Sans', sans-serif; }
.modal .form-control:focus { border-color: #5B6AF5; box-shadow: 0 0 0 3px rgba(91,106,245,0.10); outline: none; background: #fff; }
.modal .form-control:disabled, .modal .form-control[readonly] { background: rgba(249,250,251,0.8); }

/* Modal buttons */
.modal .btn-success, .modal .btn-primary { background: linear-gradient(135deg, #5B6AF5 0%, #818CF8 100%); border: none; border-radius: 12px; padding: 10px 24px; font-weight: 700; font-size: 14px; transition: all 0.2s ease; color: white; font-family: 'DM Sans', sans-serif; box-shadow: 0 4px 14px rgba(91,106,245,0.18); }
.modal .btn-success:hover, .modal .btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(91,106,245,0.22); }
.modal .btn-default, .modal .btn-secondary { background: rgba(91,106,245,0.06); color: #334155; border: 1px solid rgba(91,106,245,0.12); border-radius: 12px; padding: 10px 24px; font-weight: 700; font-size: 14px; transition: all 0.2s ease; font-family: 'DM Sans', sans-serif; }
.modal .btn-default:hover, .modal .btn-secondary:hover { background: rgba(91,106,245,0.12); color: #0F172A; }
.modal .btn-danger { background: linear-gradient(135deg, #EF4444 0%, #F87171 100%); border: none; border-radius: 12px; padding: 10px 24px; font-weight: 700; font-size: 14px; transition: all 0.2s ease; color: white; font-family: 'DM Sans', sans-serif; box-shadow: 0 4px 14px rgba(239,68,68,0.18); }
.modal .btn-danger:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(239,68,68,0.25); }

/* ── Mobile: exit unified panel, go full screen ── */
@media (max-width: 768px) {
  html, body { height: auto; overflow: auto; overflow-x: hidden; }
  body::before { inset: 0; border-radius: 0; box-shadow: none; border: none; }
  .index-content {
    position: relative;
    top: auto; right: auto; bottom: auto; left: auto;
    margin: 0;
    width: 100%;
    margin-top: calc(60px + env(safe-area-inset-top));
    padding: 16px;
    border-radius: 0;
    overflow: visible;
    min-height: 100vh;
  }
  .section-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}
