@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --app-font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --app-font-mono: 'JetBrains Mono', monospace;
  
  /* Color Palette */
  --sidebar-bg: #0f172a;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active-bg: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  --sidebar-text: #94a3b8;
  --sidebar-text-active: #ffffff;
  --sidebar-border: #1e293b;

  --main-bg: #f8fafc;
  --card-bg: #ffffff;
  --card-border: #e2e8f0;
  
  --primary-accent: #2563eb;
  --primary-light: #eff6ff;
  --success-accent: #10b981;
  --warning-accent: #f59e0b;
  --danger-accent: #ef4444;
  --info-accent: #06b6d4;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
}

body {
  font-family: var(--app-font-sans);
  background-color: var(--main-bg);
  color: #1e293b;
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overflow-x: hidden;
}

/* Layout */
.app-wrapper {
  display: flex;
  min-height: 100vh;
  width: 100%;
}

/* Sidebar */
.app-sidebar {
  width: 270px;
  background-color: var(--sidebar-bg);
  color: #f1f5f9;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1050;
}

/* Sidebar scrollbar styling */
.app-sidebar::-webkit-scrollbar {
  width: 5px;
}
.app-sidebar::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}

.sidebar-brand {
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: #ffffff;
}

.brand-icon-box {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  font-size: 1.3rem;
  color: #ffffff;
}

.brand-title {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.72rem;
  color: #64748b;
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  padding: 1.25rem 0.85rem;
  flex-grow: 1;
}

.sidebar-section-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  padding: 0.6rem 0.75rem 0.35rem;
  margin-top: 0.75rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.18s ease;
  margin-bottom: 0.2rem;
}

.sidebar-link i {
  font-size: 1.15rem;
  color: #94a3b8;
  transition: transform 0.18s ease, color 0.18s ease;
}

.sidebar-link:hover {
  background-color: var(--sidebar-hover);
  color: #ffffff;
  transform: translateX(2px);
}

.sidebar-link:hover i {
  color: #ffffff;
}

.sidebar-link.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.sidebar-link.active i {
  color: #ffffff;
}

.sidebar-badge {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 50rem;
}

/* Sidebar Footer User Box */
.sidebar-footer {
  padding: 1rem 0.85rem;
  border-top: 1px solid var(--sidebar-border);
  background-color: rgba(15, 23, 42, 0.85);
}

.user-profile-widget {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 0.75rem 0.85rem;
}

/* App Main Container */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background-color: var(--main-bg);
}

.app-topbar {
  background-color: #ffffff;
  border-bottom: 1px solid var(--card-border);
  padding: 0.85rem 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1020;
}

.app-content {
  padding: 1.75rem;
  flex-grow: 1;
}

/* Card Styling */
.card {
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background-color: #ffffff;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  border-bottom: 1px solid #f1f5f9;
  background-color: transparent;
  padding: 1rem 1.25rem;
  font-weight: 600;
}

/* KPI Card Styles */
.kpi-card {
  border-radius: 16px;
  border: none;
  overflow: hidden;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.kpi-icon-circle {
  width: 50px;
  height: 50px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

/* Tables */
.table {
  font-size: 0.88rem;
}

.table th {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  border-bottom: 2px solid #f1f5f9;
  padding: 0.85rem 1rem;
}

.table td {
  padding: 0.85rem 1rem;
  vertical-align: middle;
  border-bottom: 1px solid #f1f5f9;
}

/* Viewer Frame */
.document-frame {
  width: 100%;
  min-height: 650px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background-color: #1e293b;
}

/* Form Styles */
.form-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #334155;
  margin-bottom: 0.35rem;
}

.form-control, .form-select {
  font-size: 0.88rem;
  border-radius: 8px;
  border-color: #cbd5e1;
  padding: 0.5rem 0.85rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus, .form-select:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Mobile responsive sidebar */
.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1040;
}

@media (max-width: 991.98px) {
  .app-sidebar {
    position: fixed;
    transform: translateX(-100%);
  }

  .app-sidebar.show {
    transform: translateX(0);
  }

  .sidebar-backdrop.show {
    display: block;
  }

  .app-content {
    padding: 1rem;
  }

  .app-topbar {
    padding: 0.75rem 1rem;
  }
}
