:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --bg-color: #F3F4F6;
  --surface: #FFFFFF;
  --text-main: #1F2937;
  --text-muted: #6B7280;
  --border-color: #E5E7EB;
  --danger: #EF4444;
  --radius-lg: 16px;
  --radius-md: 8px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --transition: all 0.3s ease;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-main);
  overflow-x: hidden;
}

/* Layout */
.app-container {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 260px;
  background-color: var(--surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  z-index: 10;
}

.sidebar-header {
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border-color);
}

.logo-icon {
  font-size: 28px;
  color: var(--primary);
}

.logo-img {
  width: 32px;
  height: 32px;
  object-fit: contain;
}

.sidebar-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
}

.sidebar-nav {
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.nav-item i {
  font-size: 20px;
}

.nav-item:hover {
  background-color: #F9FAFB;
  color: var(--primary);
}

.nav-item.active {
  background-color: #EEF2FF;
  color: var(--primary);
  font-weight: 600;
}

/* Main Content */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  background-color: var(--surface);
  height: 70px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  z-index: 5;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-main);
  cursor: pointer;
}

.topbar h1 {
  font-size: 1.25rem;
  font-weight: 600;
}

.avatar {
  background-color: var(--primary);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.85rem;
}

.content-wrapper {
  padding: 32px;
  overflow-y: auto;
  flex: 1;
  position: relative;
}

/* Page Sections */
.page-section {
  display: none;
  animation: fadeIn 0.4s ease forwards;
}

.page-section.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Loader Overlay */
.loader-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(3px);
  z-index: 9999;
  gap: 16px;
  color: var(--primary);
  font-weight: 500;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Cards */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.stat-card {
  background: var(--surface);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 20px;
  border: 1px solid var(--border-color);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.stat-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 56px;
  height: 56px;
  background-color: #EEF2FF;
  color: var(--primary);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
}

.stat-info h3 {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 4px;
}

.stat-info h2 {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.mt-4 { margin-top: 24px; }
.mb-4 { margin-bottom: 24px; }

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  background-color: #FAFAFA;
}

.card-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-body {
  padding: 24px;
}

/* Typography Enhancements for Dashboard */
.welcome-text {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-main);
  margin-bottom: 24px;
}

.steps-container {
  background-color: #F9FAFB;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.steps-title {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 12px;
  color: var(--primary);
}

.steps-list {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.steps-list li {
  line-height: 1.5;
  color: var(--text-main);
}

.flex-between {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-main);
  border: 1px solid var(--border-color);
}

.btn-outline:hover {
  background-color: #F3F4F6;
}

.btn-danger {
  background-color: #FEE2E2;
  color: var(--danger);
}

.btn-danger:hover {
  background-color: #FCA5A5;
  color: white;
}

.btn-group {
  display: flex;
  gap: 12px;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th, .data-table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: #F9FAFB;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data-table td {
  font-size: 0.95rem;
}

.data-table tbody tr:hover {
  background-color: #F9FAFB;
}

/* Forms */
.form-group {
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-group-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-main);
}

input, select {
  padding: 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
  background-color: var(--surface);
  color: var(--text-main);
}

input:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

small {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 12px;
  margin-left: 8px;
  white-space: nowrap;
}

.badge-warning {
  background-color: #FEF3C7;
  color: #D97706;
}

.badge-success {
  background-color: #D1FAE5;
  color: #059669;
}

/* Modals */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.show {
  display: flex;
  opacity: 1;
}

.modal {
  background-color: var(--surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-md);
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
  transform: scale(1);
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
}

.close-btn:hover {
  color: var(--text-main);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}



/* Print Styles */
@media print {
  body {
    background-color: white;
  }
  
  .sidebar, .topbar, .no-print {
    display: none !important;
  }
  
  .main-content {
    margin: 0;
    padding: 0;
  }
  
  .content-wrapper {
    padding: 0;
  }
  
  .print-area {
    box-shadow: none !important;
    border: none !important;
  }
  
  .print-header {
    text-align: center;
    margin-bottom: 20px;
  }
  
  .print-header h2 {
    font-size: 18pt;
    font-weight: bold;
    margin-bottom: 5px;
  }
  
  .print-header h3 {
    font-size: 14pt;
    font-weight: normal;
  }
  
  .print-table {
    width: 100%;
    border-collapse: collapse;
  }
  
  .print-table th, .print-table td {
    border: 1px solid #000;
    padding: 8px;
    font-size: 12pt;
    color: #000;
  }
  
  .print-table th {
    background-color: #e5e5e5 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* Responsive Media Queries */
@media (max-width: 768px) {
  .hamburger-btn {
    display: block;
  }
  
  .sidebar {
    position: fixed;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 4px 0 20px rgba(0,0,0,0.1);
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .topbar {
    padding: 0 16px;
  }
  
  .content-wrapper {
    padding: 16px;
  }
  
  .card-header, .card-body {
    padding: 16px;
  }
  
  .form-group-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .btn-group {
    flex-direction: column;
    width: 100%;
  }
  
  .btn-group .btn {
    width: 100%;
    justify-content: center;
  }
  
  .action-bar.flex-between {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }
}

/* Public Page Styles */
.public-header {
  background-color: var(--surface);
  padding: 30px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 2px solid var(--primary);
  box-shadow: var(--shadow-sm);
  margin-bottom: 40px;
}

.public-header-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

.public-title h1 {
  font-size: 1.8rem;
  color: var(--primary);
  margin-bottom: 4px;
}

.public-title h2 {
  font-size: 1.1rem;
  color: var(--text-muted);
  font-weight: 500;
}

.public-footer {
  text-align: center;
  padding: 40px 20px;
  margin-top: 60px;
  border-top: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.9rem;
}

@media (max-width: 768px) {
  .public-header {
    flex-direction: column;
    gap: 20px;
    text-align: center;
    padding: 20px;
  }
  .public-header-content {
    flex-direction: column;
  }
  .public-title h1 {
    font-size: 1.4rem;
  }
}
