/* =====================================================================
   base.css — AuditEase Design System
   Variables, reset, typography, utilities
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

/* ── Color Tokens — Light Mode ────────────────────────────────────────── */
:root {
  --bg-primary:     #F7F8FA;
  --bg-surface:     #FFFFFF;
  --bg-raised:      #EEF0F4;
  --border:         #DDE1E9;
  --text-primary:   #111827;
  --text-secondary: #6B7280;
  --text-muted:     #9CA3AF;
  --accent:         #2563EB;
  --accent-hover:   #1D4ED8;
  --accent-subtle:  #EFF6FF;

  --status-uploaded:  #3B82F6;
  --status-pending:   #F59E0B;
  --status-action:    #EF4444;
  --status-verified:  #10B981;
  --status-submitted: #8B5CF6;
  --status-overdue:   #DC2626;
  --status-archived:  #6B7280;

  --status-uploaded-bg:  #EFF6FF;
  --status-pending-bg:   #FFFBEB;
  --status-action-bg:    #FEF2F2;
  --status-verified-bg:  #ECFDF5;
  --status-submitted-bg: #F5F3FF;
  --status-overdue-bg:   #FEF2F2;
  --status-archived-bg:  #F3F4F6;

  --topbar-height:  56px;
  --sidebar-width:  220px;
  --subnav-height:  40px;

  --radius-card:    6px;
  --radius-btn:     4px;
  --radius-input:   4px;

  --shadow-card:    0 1px 3px rgba(0, 0, 0, 0.12);
  --shadow-modal:   0 8px 32px rgba(0, 0, 0, 0.18);
  --shadow-dropdown: 0 4px 16px rgba(0, 0, 0, 0.12);

  --transition-fast: 150ms ease;
  --transition-med:  200ms ease;
  --transition-nav:  350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Color Tokens — Dark Mode ─────────────────────────────────────────── */
[data-theme="dark"] {
  --bg-primary:     #0F1117;
  --bg-surface:     #1A1D27;
  --bg-raised:      #242736;
  --border:         #2E3347;
  --text-primary:   #F1F3F9;
  --text-secondary: #9BA3B8;
  --text-muted:     #5C6480;
  --accent:         #3B82F6;
  --accent-hover:   #60A5FA;
  --accent-subtle:  #1E2D4A;

  --status-uploaded-bg:  rgba(59, 130, 246, 0.12);
  --status-pending-bg:   rgba(245, 158, 11, 0.12);
  --status-action-bg:    rgba(239, 68, 68, 0.12);
  --status-verified-bg:  rgba(16, 185, 129, 0.12);
  --status-submitted-bg: rgba(139, 92, 246, 0.12);
  --status-overdue-bg:   rgba(220, 38, 38, 0.12);
  --status-archived-bg:  rgba(107, 114, 128, 0.12);

  --shadow-card:    0 1px 4px rgba(0, 0, 0, 0.4);
  --shadow-modal:   0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-dropdown: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ── Reset ────────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 14px;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

/* ── Typography ───────────────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

.mono {
  font-family: 'IBM Plex Mono', 'Courier New', monospace;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  font-family: inherit;
  border-radius: var(--radius-btn);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  line-height: 1.4;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--status-action);
  color: #fff;
  border-color: var(--status-action);
}

.btn-danger:hover {
  background: #dc2626;
  border-color: #dc2626;
}

.btn-sm {
  padding: 4px 10px;
  font-size: 12px;
}

.btn-icon {
  padding: 6px;
  border-radius: var(--radius-btn);
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-icon:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
}

/* ── Form Inputs ──────────────────────────────────────────────────────── */
input, select, textarea {
  font-family: inherit;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 7px 10px;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  outline: none;
  width: 100%;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 28px;
}

label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 4px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}

/* ── Cards ────────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
}

/* ── Badges / Status ──────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.badge-uploaded  { background: var(--status-uploaded-bg);  color: var(--status-uploaded); }
.badge-pending   { background: var(--status-pending-bg);   color: var(--status-pending); }
.badge-action    { background: var(--status-action-bg);    color: var(--status-action); }
.badge-verified  { background: var(--status-verified-bg);  color: var(--status-verified); }
.badge-submitted { background: var(--status-submitted-bg); color: var(--status-submitted); }
.badge-overdue   { background: var(--status-overdue-bg);   color: var(--status-overdue); }
.badge-archived  { background: var(--status-archived-bg);  color: var(--status-archived); }

/* ── Layout Helpers ───────────────────────────────────────────────────── */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.w-full { width: 100%; }

/* ── Page Layout ──────────────────────────────────────────────────────── */
.page-layout {
  display: flex;
  min-height: 100vh;
  padding-top: var(--topbar-height);
}

.page-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  padding: 24px;
}

.page-content.with-subnav {
  padding-top: 0;
}

/* ── Divider ──────────────────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
}

/* ── Overlay ──────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  animation: fadeIn 150ms ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

@keyframes slideInUp {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Scrollbar Styling ────────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ── Loading Spinner ──────────────────────────────────────────────────── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

/* ── Empty State ──────────────────────────────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}



/* ── Tooltip ──────────────────────────────────────────────────────────── */
[data-tooltip] {
  position: relative;
}

[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--bg-surface);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 1000;
}

[data-tooltip]:hover::after {
  opacity: 1;
}

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-content {
    margin-left: 0;
    padding: 16px;
  }
}
