/*
 * ══════════════════════════════════════════════════
 *  AMS PORTAL — Static Design System CSS
 *  Replaces @apply Tailwind CDN (fallback safe)
 * ══════════════════════════════════════════════════
 */

/* ── BRAND COLORS (CSS Variables) ─────────────── */
:root {
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-300: #93c5fd;
  --brand-400: #60a5fa;
  --brand-500: #3b82f6;
  --brand-600: #2563eb;
  --brand-700: #1d4ed8;
  --brand-800: #1e40af;
  --brand-900: #1e3a8a;
  --brand-950: #1e3a5f;
  --gold-400:  #fbbf24;
  --gold-500:  #f59e0b;
  --shadow-card: 0 1px 3px rgba(0,0,0,0.02), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-soft: 0 4px 20px -2px rgba(0,0,0,0.05);
}

/* ── BASE ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  background-color: #F8F9FA;
  font-family: 'Inter', sans-serif;
  color: #334155;
  -webkit-font-smoothing: antialiased;
  margin: 0;
}

/* ── SCROLLBAR ─────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── INPUTS ────────────────────────────────────── */
.input-premium,
input[type="text"]:not(.no-style),
input[type="email"]:not(.no-style),
input[type="tel"]:not(.no-style),
input[type="number"]:not(.no-style),
input[type="date"]:not(.no-style),
input[type="password"]:not(.no-style),
select:not(.no-style),
.form-input {
  width: 100%;
  padding: 0.5rem 1rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  color: #1e293b;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  line-height: 1.625;
  outline: none;
  transition: all 0.2s;
}

input[type="text"]:not(.no-style):focus,
input[type="email"]:not(.no-style):focus,
input[type="tel"]:not(.no-style):focus,
input[type="number"]:not(.no-style):focus,
input[type="date"]:not(.no-style):focus,
input[type="password"]:not(.no-style):focus,
select:not(.no-style):focus,
.input-premium:focus,
.form-input:focus {
  background-color: #fff;
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
}

input::placeholder,
textarea::placeholder { color: #94a3b8; }

textarea.input-premium,
textarea.form-input,
textarea:not(.no-style) {
  width: 100%;
  padding: 0.5rem 1rem;
  background-color: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  color: #1e293b;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: all 0.2s;
  resize: vertical;
}

textarea:not(.no-style):focus { background-color: #fff; border-color: var(--brand-500); box-shadow: 0 0 0 4px rgba(59,130,246,0.1); }

/* Custom Select Arrow */
select.input-premium,
select:not(.no-style),
select.form-input {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 1.25em 1.25em;
  padding-right: 2.75rem !important;
  cursor: pointer;
}

/* Input with icon */
.input-with-icon { position: relative; }
.input-with-icon .icon {
  position: absolute; left: 0.875rem; top: 50%; transform: translateY(-50%);
  color: #94a3b8; pointer-events: none; width: 1rem; height: 1rem;
}
.input-with-icon input,
.input-with-icon select { padding-left: 2.75rem !important; }
.pl-11 { padding-left: 2.75rem !important; }

/* ── LABELS ────────────────────────────────────── */
.label-premium, .form-label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 900;
  color: #64748b;
  margin-bottom: 0.375rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ── CARDS ─────────────────────────────────────── */
.card, .card-premium {
  background: #fff;
  border-radius: 1rem;
  box-shadow: var(--shadow-card);
  border: 1px solid #f1f5f9;
  overflow: hidden;
}
.card-premium { padding: 1.5rem; }

/* Subcard inside card */
.field-group {
  background: #f8fafc;
  border: 1px solid #f1f5f9;
  border-radius: 1rem;
  padding: 1.25rem;
}
.field-group-header { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 1rem; }
.field-group-icon { width: 28px; height: 28px; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.field-group-title { font-size: 0.6875rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.12em; color: #64748b; }

/* ── BUTTONS ───────────────────────────────────── */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: linear-gradient(to right, var(--brand-700), var(--brand-500));
  color: #fff;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: none;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  font-size: 0.875rem;
}
.btn-primary:hover {
  background: linear-gradient(to right, var(--brand-800), var(--brand-600));
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
  color: #fff;
}

.btn-back, .btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: #fff;
  color: #334155;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 0.875rem;
}
.btn-back:hover, .btn-secondary:hover { background: #f8fafc; }

.btn-outline {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: transparent;
  color: var(--brand-700);
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: 2px solid var(--brand-100);
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  font-size: 0.875rem;
}
.btn-outline:hover { background: var(--brand-50); border-color: var(--brand-200); }

.btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  background: linear-gradient(to right, #dc2626, #ef4444);
  color: #fff;
  font-weight: 500;
  font-family: 'Inter', sans-serif;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s;
  text-decoration: none;
  font-size: 0.875rem;
}
.btn-danger:hover { background: linear-gradient(to right, #b91c1c, #dc2626); }

.btn-fintech { border: 1px solid var(--brand-300); }

/* ── ACTION BAR ────────────────────────────────── */
.action-bar {
  display: flex; align-items: center; justify-content: flex-end;
  gap: 0.625rem; padding-top: 1.5rem; margin-top: 1.5rem;
  border-top: 1px solid #f1f5f9;
}
.action-bar .btn-primary { min-width: 160px; }

@media (max-width: 639px) {
  .action-bar { flex-direction: column-reverse; }
  .action-bar .btn-primary,
  .action-bar .btn-back { width: 100%; }
}

/* ── BADGES ─────────────────────────────────────── */
.badge-success { display:inline-flex;align-items:center;gap:0.25rem;font-size:0.6875rem;font-weight:700;padding:0.2rem 0.625rem;border-radius:20px;background:#d1fae5;color:#065f46;border:1px solid #a7f3d0; }
.badge-warning { display:inline-flex;align-items:center;gap:0.25rem;font-size:0.6875rem;font-weight:700;padding:0.2rem 0.625rem;border-radius:20px;background:#fef3c7;color:#92400e;border:1px solid #fde68a; }
.badge-danger  { display:inline-flex;align-items:center;gap:0.25rem;font-size:0.6875rem;font-weight:700;padding:0.2rem 0.625rem;border-radius:20px;background:#fee2e2;color:#991b1b;border:1px solid #fca5a5; }
.badge-info    { display:inline-flex;align-items:center;gap:0.25rem;font-size:0.6875rem;font-weight:700;padding:0.2rem 0.625rem;border-radius:20px;background:#dbeafe;color:#1e40af;border:1px solid #bfdbfe; }
.badge-neutral { display:inline-flex;align-items:center;gap:0.25rem;font-size:0.6875rem;font-weight:700;padding:0.2rem 0.625rem;border-radius:20px;background:#f1f5f9;color:#475569;border:1px solid #e2e8f0; }
.badge-gray    { display:inline-flex;align-items:center;gap:0.25rem;font-size:0.6875rem;font-weight:700;padding:0.2rem 0.625rem;border-radius:20px;background:#f1f5f9;color:#475569;border:1px solid #e2e8f0; }

/* ── ALERTS ─────────────────────────────────────── */
.alert-info    { background:#eff6ff;border:1px solid #bfdbfe;border-radius:12px;padding:0.875rem 1rem;font-size:0.8125rem; }
.alert-warning { background:#fffbeb;border:1px solid #fde68a;border-radius:12px;padding:0.875rem 1rem;font-size:0.8125rem; }
.alert-success { background:#ecfdf5;border:1px solid #a7f3d0;border-radius:12px;padding:0.875rem 1rem;font-size:0.8125rem; }
.alert-error   { background:#fef2f2;border:1px solid #fca5a5;border-radius:12px;padding:0.875rem 1rem;font-size:0.8125rem; }

/* ── WIZARD SIDEBAR ─────────────────────────────── */
.step-item { display:flex; align-items:flex-start; gap:0.4rem; padding:0.25rem 0.5rem; border-radius:8px; transition:background 0.2s; }
.step-item.active { background:#eff6ff; }
.step-item.pending { opacity:0.45; }

.step-dot { width:22px;height:22px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-weight:800;font-size:10px;flex-shrink:0;margin-top:2px;transition:all 0.25s; }
.step-dot.done    { background:#2563eb;color:#fff;box-shadow:0 2px 6px -1px rgba(37,99,235,0.4); }
.step-dot.active  { background:#fff;border:2px solid #2563eb;color:#2563eb;box-shadow:0 0 0 3px rgba(59,130,246,0.12); }
.step-dot.pending { background:#f1f5f9;border:2px solid #e2e8f0;color:#94a3b8; }

.step-connector { width:2px;height:8px;margin-left:10px;background:#e8edf2;border-radius:2px; }
.step-connector.done { background:#bfdbfe; }

/* ── PAGE SECTION TITLE ─────────────────────────── */
.step-header {
  position: relative;
  margin-bottom: 1.25rem;
}
.step-page-title {
  font-size: 1.375rem; font-weight: 900;
  background: linear-gradient(135deg, #0f172a 0%, #3b82f6 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em; line-height: 1.2;
}
.step-page-subtitle { font-size: 0.8125rem; color: #64748b; margin-top: 0.35rem; font-weight: 500; }

/* ── ANIMATIONS ─────────────────────────────────── */
.slide-up { animation: slideUp 0.4s cubic-bezier(0.16,1,0.3,1) both; }
.fade-in  { animation: fadeIn 0.3s ease both; }
@keyframes slideUp { from { opacity:0; transform:translateY(16px); } to { opacity:1; transform:translateY(0); } }
@keyframes fadeIn  { from { opacity:0; } to { opacity:1; } }

.slide-up > * { animation: slideUp 0.4s cubic-bezier(0.16,1,0.3,1) both; }
.slide-up > *:nth-child(1) { animation-delay:0.05s; }
.slide-up > *:nth-child(2) { animation-delay:0.10s; }
.slide-up > *:nth-child(3) { animation-delay:0.15s; }
.slide-up > *:nth-child(4) { animation-delay:0.20s; }

/* ── MISC ───────────────────────────────────────── */
.divider { height:1px; background:#f1f5f9; margin:1.25rem 0; }
.field-hint { font-size:0.6875rem; color:#94a3b8; font-style:italic; margin-top:0.3rem; padding-left:0.25rem; }
:focus-visible { outline:2px solid var(--brand-400); outline-offset:2px; }
[x-cloak] { display: none !important; }

/* ── MOBILE ACTION BAR ──────────────────────────── */
@media (max-width: 639px) {
  .mobile-action-bar {
    position:fixed; bottom:0; left:0; right:0;
    padding:0.875rem 1rem calc(0.875rem + env(safe-area-inset-bottom));
    background:rgba(255,255,255,0.95);
    backdrop-filter:blur(16px);
    border-top:1px solid #f1f5f9;
    z-index:50; display:flex; gap:0.5rem;
  }
  .mobile-action-bar .btn-primary { flex:1; }
  .mobile-action-bar .btn-back { flex-shrink:0; }
  .pb-mobile { padding-bottom:5rem !important; }
  .footer-mobile-nav-adjust { padding-bottom:calc(4.75rem + env(safe-area-inset-bottom)) !important; }
}
@media (min-width: 640px) { .mobile-action-bar { display:none !important; } }

/* ── NAV ITEMS (Dashboard/Admin) ─────────────────── */
.nav-item {
  display:flex; align-items:center; justify-content:space-between;
  padding:0.625rem 0.75rem; border-radius:0.75rem;
  color:#bfdbfe; font-size:0.875rem; font-weight:500;
  text-decoration:none; margin-bottom:0.25rem;
  transition:all 0.2s; background:transparent; border:none; width:100%; cursor:pointer;
}
.nav-item:hover { color:#fff; background:rgba(30,64,175,0.5); }
.nav-item.active { background:#1e40af; color:#fff; font-weight:600; box-shadow:0 1px 2px rgba(0,0,0,0.05); }
.nav-icon { width:1.25rem; height:1.25rem; margin-right:0.75rem; color:#93c5fd; transition:colors 0.2s; }
.nav-item:hover .nav-icon { color:#bfdbfe; }
.nav-item.active .nav-icon { color:#fff; }

.nav-submenu-container { padding-left:2.25rem; padding-right:0.75rem; padding-top:0.25rem; padding-bottom:0.25rem; }
.nav-submenu {
  display:block; padding:0.5rem 0.75rem; border-radius:0.5rem;
  font-size:0.8125rem; font-weight:500; color:#a5c4f8;
  text-decoration:none; transition:all 0.2s;
}
.nav-submenu:hover { color:#fff; background:rgba(30,64,175,0.3); }
.nav-submenu.active { color:#fff; background:rgba(30,64,175,0.3); }

.sidebar-section { font-size:0.6875rem; font-weight:700; color:#60a5fa; text-transform:uppercase; letter-spacing:0.1em; padding:0 0.75rem; margin-top:1.5rem; margin-bottom:0.5rem; }

/* Sidebar scrollbar */
.sidebar-scroll::-webkit-scrollbar { width:4px; }
.sidebar-scroll::-webkit-scrollbar-thumb { background:#1e40af; border-radius:10px; }
.sidebar-scroll::-webkit-scrollbar-thumb:hover { background:#3b82f6; }

/* ── TABLE ───────────────────────────────────────── */
.table-row { border-bottom:1px solid #f1f5f9; transition:background 0.15s; }
.table-row:last-child { border-bottom:none; }
.table-row:hover { background:#f8fafc; }
