/* ==========================================
   GLOBAL STYLES - ABP CMS Global Resources
   ========================================== */

/* 1. CSS Variables / Design Tokens */
:root {
  --primary:        #4361ee;
  --primary-dark:   #3651d4;
  --secondary:      #7209b7;
  --accent:         #f72585;
  --success:        #2dc653;
  --warning:        #ffd60a;
  --danger:         #ef233c;
  --info:           #4cc9f0;

  --bg-light:       #f8f9fa;
  --bg-dark:        #1a1a2e;
  --surface:        #ffffff;
  --border:         #dee2e6;

  --text-primary:   #212529;
  --text-secondary: #6c757d;
  --text-muted:     #adb5bd;
  --text-white:     #ffffff;

  --font-sans:      'Inter', 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono:      'Fira Code', 'Courier New', monospace;

  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      16px;
  --radius-full:    9999px;

  --shadow-sm:      0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg:      0 8px 32px rgba(0,0,0,0.18);

  --transition:     all 0.25s ease;
  --transition-slow:all 0.5s ease;

  --z-dropdown:     1000;
  --z-sticky:       1020;
  --z-modal:        1050;
  --z-tooltip:      1070;
  --z-toast:        1090;
}

/* 2. Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background-color: var(--bg-light);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: var(--transition);
}
a:hover { color: var(--primary-dark); text-decoration: underline; }

/* 3. Typography */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 0.5em;
}
h1 { font-size: clamp(1.8rem, 4vw, 2.8rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2.2rem); }
h3 { font-size: clamp(1.2rem, 2.5vw, 1.7rem); }
h4 { font-size: 1.3rem; }
h5 { font-size: 1.1rem; }
h6 { font-size: 0.95rem; }

p { margin-bottom: 1rem; color: var(--text-secondary); }

/* 4. Navbar Scroll State */
nav.scrolled,
header.scrolled {
  box-shadow: var(--shadow-md);
  background: rgba(255, 255, 255, 0.97) !important;
  backdrop-filter: blur(8px);
  transition: var(--transition);
}

/* 5. Back to Top Button */
#backToTop {
  display: none;
  position: fixed;
  bottom: 30px;
  right: 30px;
  z-index: var(--z-toast);
  width: 48px;
  height: 48px;
  border-radius: var(--radius-full);
  background: var(--primary);
  color: #fff;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  transition: var(--transition);
}
#backToTop:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* 6. Tooltip */
.global-tooltip {
  position: absolute;
  background: #333;
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  pointer-events: none;
  z-index: var(--z-tooltip);
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  animation: fadeIn 0.2s ease;
}
.global-tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

/* 7. Lazy Image */
img[data-src] { opacity: 0; transition: opacity 0.4s ease; }
img[data-src].loaded { opacity: 1; }

/* 8. Buttons - Global Overrides */
.btn, button[type="submit"] {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-sans);
  font-weight: 600;
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
  letter-spacing: 0.02em;
}
.btn-primary, button[type="submit"] {
  background: var(--primary);
  color: #fff;
  border: none;
}
.btn-primary:hover, button[type="submit"]:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(67,97,238,0.35);
  transform: translateY(-1px);
}

/* 9. Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: var(--transition);
  overflow: hidden;
}
.card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

/* 10. Forms */
.form-control,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
textarea,
select {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text-primary);
  background: var(--surface);
  transition: var(--transition);
  outline: none;
}
.form-control:focus,
input[type="text"]:focus,
input[type="email"]:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(67,97,238,0.15);
}

/* 11. Alerts / Flash Messages */
.alert, .flash-message, .notification {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  margin-bottom: 1rem;
  font-size: 0.92rem;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
}
.alert-success  { background: #d4f8e0; color: #1a7a3f; border-left: 4px solid var(--success); }
.alert-danger   { background: #fde8ec; color: #a71d31; border-left: 4px solid var(--danger); }
.alert-warning  { background: #fff8dc; color: #7a6000; border-left: 4px solid var(--warning); }
.alert-info     { background: #e0f5fd; color: #1a6e8a; border-left: 4px solid var(--info); }

/* 12. Badge */
.badge {
  display: inline-block;
  padding: 3px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.badge-primary  { background: var(--primary);   color: #fff; }
.badge-success  { background: var(--success);   color: #fff; }
.badge-danger   { background: var(--danger);    color: #fff; }
.badge-warning  { background: var(--warning);   color: #333; }

/* 13. Table */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
thead th {
  background: var(--primary);
  color: #fff;
  padding: 12px 16px;
  text-align: left;
  font-weight: 600;
}
tbody td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
tbody tr:hover { background: #f0f4ff; }
tbody tr:last-child td { border-bottom: none; }

/* 14. Section Utilities */
.section         { padding: 60px 0; }
.section-sm      { padding: 30px 0; }
.section-lg      { padding: 100px 0; }
.text-center     { text-align: center; }
.text-right      { text-align: right; }
.container       { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.mt-auto         { margin-top: auto; }
.d-flex          { display: flex; }
.align-center    { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1           { gap: 8px; }
.gap-2           { gap: 16px; }
.gap-3           { gap: 24px; }
.w-full          { width: 100%; }
.rounded         { border-radius: var(--radius-md); }
.rounded-full    { border-radius: var(--radius-full); }
.shadow          { box-shadow: var(--shadow-md); }

/* 15. Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.05); }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

.animate-fadeIn    { animation: fadeIn 0.4s ease both; }
.animate-slideLeft { animation: slideInLeft 0.4s ease both; }
.animate-pulse     { animation: pulse 2s infinite; }

/* 16. Loader / Spinner */
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid rgba(67,97,238,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: auto;
}

/* 17. Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}
.divider-thick { border-top-width: 3px; border-color: var(--primary); }

/* 18. Active Nav Link */
nav a.active,
.menu a.active {
  color: var(--primary) !important;
  font-weight: 700;
  border-bottom: 2px solid var(--primary);
}

/* 19. Scrollbar Styling */
::-webkit-scrollbar       { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg-light); }
::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary-dark); }

/* 20. Responsive */
@media (max-width: 768px) {
  html { font-size: 15px; }
  .section   { padding: 40px 0; }
  .section-lg{ padding: 60px 0; }
  .container { padding: 0 16px; }
  #backToTop { bottom: 20px; right: 16px; width: 42px; height: 42px; }
  table { font-size: 0.82rem; }
  thead th, tbody td { padding: 9px 10px; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.6rem; }
  h2 { font-size: 1.3rem; }
  .btn { width: 100%; justify-content: center; }
}

/* 21. Print Styles */
@media print {
  nav, header, footer, #backToTop, .no-print { display: none !important; }
  body { font-size: 12pt; color: #000; background: #fff; }
  a    { color: #000; text-decoration: underline; }
}