/**
 * SISTEM ARSIP SURAT KERJA SAMA - SMK NEGERI 1 PROBOLINGGO
 * Modern, Clean, Elegant & Responsive CSS Architecture
 */

:root {
  --primary: #1e3a8a;          /* Deep School Blue */
  --primary-hover: #1e40af;
  --primary-light: #eff6ff;
  --primary-subtle: #dbeafe;
  
  --secondary: #0f766e;        /* Dark Cyan / Teal Accent */
  --secondary-light: #f0fdfa;
  
  --success: #15803d;          /* Forest Green */
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  
  --warning: #b45309;          /* Amber */
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  
  --danger: #b91c1c;           /* Rose/Crimson */
  --danger-bg: #fef2f2;
  --danger-border: #fecaca;
  
  --info: #0369a1;             /* Sky */
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;
  
  --bg-main: #f8fafc;          /* Slate 50 */
  --bg-surface: #ffffff;
  --bg-sidebar: #0f172a;       /* Slate 900 */
  --bg-sidebar-hover: #1e293b;
  --bg-sidebar-active: #2563eb;
  
  --text-main: #1e293b;        /* Slate 800 */
  --text-muted: #64748b;       /* Slate 500 */
  --text-light: #94a3b8;       /* Slate 400 */
  --text-inverse: #ffffff;
  
  --border-color: #e2e8f0;     /* Slate 200 */
  --border-focus: #3b82f6;
  
  --sidebar-width: 260px;
  --header-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  
  --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);
  
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --transition: all 0.2s ease-in-out;
}

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

html, body {
  height: 100%;
  font-family: var(--font-family);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-main);
  background-color: var(--bg-main);
  -webkit-font-smoothing: antialiased;
}

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

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

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

/* Sidebar */
.app-sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-sidebar);
  color: var(--text-light);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: transform 0.3s ease;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(15, 23, 42, 0.95);
  position: relative;
}

.sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 15px;
  cursor: pointer;
  padding: 5px 9px;
  line-height: 1;
  border-radius: var(--radius-sm);
  margin-left: auto;
  transition: var(--transition);
}

.sidebar-close-btn:hover {
  background: rgba(239, 68, 68, 0.4);
  border-color: rgba(239, 68, 68, 0.6);
  color: #ffffff;
}

body.sidebar-open {
  overflow: hidden;
}

.sidebar-logo {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebar-logo img, .brand-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-inverse);
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-light);
}

.sidebar-menu {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  list-style: none;
}

.menu-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  padding: 14px 12px 6px;
}

.menu-item {
  margin-bottom: 3px;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #94a3b8;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
}

.menu-link:hover {
  background-color: var(--bg-sidebar-hover);
  color: var(--text-inverse);
}

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

.menu-icon {
  font-size: 16px;
  width: 20px;
  text-align: center;
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(15, 23, 42, 0.6);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #3b82f6;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.badge-role-admin { background: #fee2e2; color: #991b1b; }
.badge-role-petugas { background: #dbeafe; color: #1e40af; }
.badge-role-viewer { background: #f1f5f9; color: #475569; }

/* Main Content Area */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* Header Navbar */
.app-header {
  height: var(--header-height);
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.mobile-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 18px;
  cursor: pointer;
  color: var(--text-main);
}

.header-page-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-main);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-user-info {
  text-align: right;
}

.header-user-name {
  font-weight: 600;
  font-size: 13px;
  color: #1e293b;
  line-height: 1.2;
}

.header-user-role {
  font-size: 11.5px;
  color: #64748b;
}

.header-logout-btn {
  white-space: nowrap;
}

/* Page Content Container */
.page-container {
  padding: 24px;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  color: #0f172a;
}

.page-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

/* Cards & Surfaces */
.card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  overflow: hidden;
}

.card-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #ffffff;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: #0f172a;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 20px;
}

.card-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: #fafafa;
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-icon-blue { background: #eff6ff; color: #2563eb; }
.stat-icon-emerald { background: #ecfdf5; color: #059669; }
.stat-icon-amber { background: #fffbeb; color: #d97706; }
.stat-icon-purple { background: #faf5ff; color: #9333ea; }

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.1;
}

.stat-label {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Category Grid Cards (Arsip Surat Menu) */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.category-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
}

.category-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--primary);
  opacity: 0;
  transition: var(--transition);
}

.category-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #cbd5e1;
}

.category-card:hover::before {
  opacity: 1;
}

.category-card-top {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 14px;
}

.category-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

.category-card-name {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.3;
}

.category-card-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.category-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  border-top: 1px solid #f1f5f9;
}

.category-count {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  background: #f8fafc;
  padding: 4px 10px;
  border-radius: 20px;
  border: 1px solid #e2e8f0;
}

.category-arrow {
  color: #94a3b8;
  font-size: 16px;
  transition: var(--transition);
}

.category-card:hover .category-arrow {
  color: var(--primary);
  transform: translateX(4px);
}

/* Forms & Inputs */
.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 6px;
}

.form-label .required {
  color: var(--danger);
}

.form-control, .form-select {
  width: 100%;
  padding: 9px 13px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-main);
  background-color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  outline: none;
  transition: var(--transition);
}

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

textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.form-col {
  flex: 1;
  min-width: 240px;
}

/* File Upload Zone */
.file-upload-box {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-md);
  padding: 28px 20px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.file-upload-box:hover, .file-upload-box.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.file-upload-icon {
  font-size: 36px;
  color: #64748b;
  margin-bottom: 8px;
}

.file-upload-text {
  font-size: 14px;
  font-weight: 600;
  color: #334155;
}

.file-upload-subtext {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.file-upload-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-selected-info {
  display: none;
  margin-top: 12px;
  padding: 10px 14px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  text-align: left;
  font-size: 13px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  font-size: 13.5px;
  font-weight: 600;
  font-family: inherit;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: var(--transition);
  line-height: 1.4;
}

.btn-primary {
  background-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  color: #ffffff;
}

.btn-secondary {
  background-color: #f1f5f9;
  color: #334155;
  border-color: #cbd5e1;
}

.btn-secondary:hover {
  background-color: #e2e8f0;
  color: #0f172a;
}

.btn-success {
  background-color: var(--success);
  color: #ffffff;
}

.btn-success:hover {
  background-color: #166534;
  color: #ffffff;
}

.btn-danger {
  background-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #991b1b;
  color: #ffffff;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
}

.btn-lg {
  padding: 11px 22px;
  font-size: 15px;
}

.btn-group {
  display: inline-flex;
  gap: 6px;
}

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13.5px;
}

.table th {
  background-color: #f8fafc;
  color: #475569;
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}

.table td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-color);
  color: var(--text-main);
  vertical-align: middle;
}

.table tr:last-child td {
  border-bottom: none;
}

.table tr:hover td {
  background-color: #f8fafc;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 4px;
  white-space: nowrap;
}

.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-emerald { background: #d1fae5; color: #065f46; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-purple { background: #f3e8ff; color: #6b21a8; }
.badge-rose { background: #ffe4e6; color: #9f1239; }
.badge-slate { background: #f1f5f9; color: #334155; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-red { background: #fee2e2; color: #991b1b; }

/* Filter Bar */
.filter-bar {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.filter-item {
  flex: 1;
  min-width: 170px;
}

.filter-search {
  flex: 2;
  min-width: 240px;
}

/* Pagination */
.pagination-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.pagination-info {
  font-size: 13px;
  color: var(--text-muted);
}

.pagination {
  display: flex;
  gap: 4px;
  list-style: none;
}

.page-item .page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: #fff;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
}

.page-item.active .page-link {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
}

.page-item.disabled .page-link {
  color: #cbd5e1;
  pointer-events: none;
  background: #f8fafc;
}

.page-item .page-link:hover {
  background: #f1f5f9;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 48px 24px;
  background: #ffffff;
  border: 1px dashed #cbd5e1;
  border-radius: var(--radius-md);
}

.empty-icon {
  font-size: 48px;
  color: #94a3b8;
  margin-bottom: 12px;
}

.empty-title {
  font-size: 17px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 13.5px;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0 auto 18px;
}

/* Alerts / Flash messages */
.flash-container {
  margin-bottom: 20px;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-size: 13.5px;
  position: relative;
}

.alert-success { background: var(--success-bg); border: 1px solid var(--success-border); color: var(--success); }
.alert-error { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger); }
.alert-warning { background: var(--warning-bg); border: 1px solid var(--warning-border); color: var(--warning); }
.alert-info { background: var(--info-bg); border: 1px solid var(--info-border); color: var(--info); }

.alert-icon { font-size: 16px; line-height: 1.3; }
.alert-content { flex: 1; line-height: 1.4; }
.alert-close {
  background: none;
  border: none;
  font-size: 18px;
  line-height: 1;
  color: inherit;
  opacity: 0.6;
  cursor: pointer;
  padding: 0 4px;
}
.alert-close:hover { opacity: 1; }

/* Modal Architecture */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-backdrop.show {
  display: flex;
}

.modal-dialog {
  background: #ffffff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  overflow: hidden;
  animation: modalPop 0.2s ease-out;
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 16px;
  font-weight: 700;
  color: #0f172a;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #64748b;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

/* Detail View Components */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.detail-item {
  padding: 12px 14px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  border: 1px solid #e2e8f0;
}

.detail-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #64748b;
  margin-bottom: 4px;
}

.detail-value {
  font-size: 14.5px;
  font-weight: 500;
  color: #0f172a;
}

/* Login Page Styles */
.login-body {
  background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2), 0 10px 10px -5px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 420px;
  padding: 36px 32px;
}

.login-brand {
  text-align: center;
  margin-bottom: 28px;
}

.login-logo {
  width: 80px;
  height: 80px;
  background: #ffffff;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  margin-bottom: 14px;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.18);
  overflow: hidden;
}

.login-logo img, .login-logo-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.login-title {
  font-size: 20px;
  font-weight: 800;
  color: #0f172a;
}

.login-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-top: 4px;
}

/* Footer */
.app-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 12.5px;
  color: var(--text-muted);
  text-align: center;
}

/* Enhanced Search & Filter Components */
.search-hero-card {
  background: #ffffff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-md);
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.05);
  position: relative;
}

.search-hero-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #2563eb, #3b82f6);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.search-hero-title {
  font-size: 16px;
  font-weight: 700;
  color: #1e3a8a;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.search-hero-subtitle {
  font-size: 13px;
  color: #64748b;
  margin-bottom: 16px;
}

.search-main-input-wrap {
  position: relative;
  margin-bottom: 16px;
}

.search-main-input {
  width: 100%;
  padding: 12px 18px 12px 42px;
  font-size: 14.5px;
  font-family: inherit;
  border: 1.5px solid #93c5fd;
  border-radius: var(--radius-sm);
  outline: none;
  background: #f8fafc;
  color: #0f172a;
  transition: var(--transition);
}

.search-main-input:focus {
  background: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.search-input-icon {
  position: absolute;
  top: 50%;
  left: 14px;
  transform: translateY(-50%);
  font-size: 18px;
  color: #64748b;
  pointer-events: none;
}

.search-filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.date-type-selector {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 8px;
  font-size: 12.5px;
  color: #475569;
}

.date-type-radio {
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  font-weight: 500;
}

.date-type-radio input {
  cursor: pointer;
}

.quick-date-pills {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.quick-date-btn {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #475569;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  display: inline-block;
}

.quick-date-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.quick-date-btn.active {
  background: #dbeafe;
  border-color: #93c5fd;
  color: #1e40af;
  font-weight: 600;
}

.search-highlight {
  background-color: #fef08a;
  color: #713f12;
  padding: 1px 3px;
  border-radius: 3px;
  font-weight: 600;
}

.active-filter-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  font-size: 12.5px;
}

.filter-chip {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #334155;
  font-size: 11.5px;
}

/* ==============================================================================
   RESPONSIVE DESIGN SYSTEM (Tablets & Mobile Smartphones)
   ============================================================================== */

/* 1. Medium Tablets & Laptops (max-width: 992px) */
@media (max-width: 992px) {
  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
}

/* 2. Small Tablets & Handheld Devices (max-width: 768px) */
@media (max-width: 768px) {
  /* Off-canvas Sidebar Drawer */
  .app-sidebar {
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 0 0 35px rgba(0, 0, 0, 0.65);
    z-index: 1000;
  }

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

  .sidebar-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999;
    display: none;
  }

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

  .sidebar-close-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Main Container & Topbar */
  .app-main {
    margin-left: 0;
  }

  .mobile-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .app-header {
    padding: 0 14px;
  }

  .header-page-title {
    font-size: 15px;
    max-width: 180px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-user-info {
    display: none;
  }

  .page-container {
    padding: 14px;
  }

  /* Page Header & Actions */
  .page-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    margin-bottom: 18px;
  }

  .page-header > div:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .page-header > div:last-child .btn {
    flex: 1;
    min-width: 120px;
    justify-content: center;
  }

  /* Forms & Inputs */
  .form-row {
    flex-direction: column;
    gap: 0;
  }

  .form-col {
    min-width: 100% !important;
    max-width: 100% !important;
  }

  /* Search & Hero Card */
  .search-hero-card {
    padding: 16px;
    margin-bottom: 18px;
  }

  .search-filter-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .search-form-actions {
    flex-direction: column-reverse;
    width: 100%;
    gap: 8px;
  }

  .search-form-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .dashboard-search-row {
    flex-direction: column;
    gap: 8px;
  }

  .dashboard-search-row .btn {
    width: 100%;
    justify-content: center;
  }

  .date-type-selector {
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Data Tables */
  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
  }

  .table th, .table td {
    padding: 10px 12px;
    font-size: 12.5px;
  }

  .table .btn-group {
    white-space: nowrap;
  }

  /* Filter Bar (Admin Logs, dll) */
  .filter-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 14px;
  }

  .filter-item, .filter-search {
    min-width: 100%;
    width: 100%;
  }

  .filter-bar > div:last-child {
    display: flex;
    gap: 8px;
  }

  .filter-bar > div:last-child .btn {
    flex: 1;
    justify-content: center;
  }

  /* Detail Grid */
  .detail-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* Modals */
  .modal-dialog {
    max-width: 95vw;
    margin: 10px auto;
  }

  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .modal-footer .btn,
  .modal-footer form,
  .modal-footer form .btn {
    width: 100%;
    justify-content: center;
  }

  /* Pagination */
  .pagination-container {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
  }

  .pagination {
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* 3. Mobile Phones (max-width: 576px) */
@media (max-width: 576px) {
  .header-page-title {
    font-size: 14px;
    max-width: 145px;
  }

  .header-logout-btn .logout-text {
    display: none;
  }

  .header-logout-btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stat-card {
    padding: 12px 10px;
    gap: 10px;
  }

  .stat-icon {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .stat-value {
    font-size: 20px;
  }

  .stat-label {
    font-size: 11px;
  }

  .category-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .search-filter-grid {
    grid-template-columns: 1fr;
  }

  .quick-date-pills {
    gap: 5px;
  }

  .quick-date-btn {
    font-size: 11px;
    padding: 4px 8px;
  }

  .active-filter-chips {
    padding: 8px 10px;
    font-size: 11.5px;
  }

  .card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 12px 14px;
  }

  .card-body {
    padding: 14px;
  }

  .login-card {
    padding: 24px 18px;
  }

  .login-title {
    font-size: 18px;
  }

  .search-main-input {
    font-size: 13.5px;
    padding: 10px 12px 10px 38px;
  }
}

/* 4. Extra Small Screens (max-width: 380px) */
@media (max-width: 380px) {
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .header-page-title {
    max-width: 110px;
  }
}

