/* Modern Responsive CSS for Laboratory Management System */

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

:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --secondary: #0284c7;
  --accent: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --dark: #0f172a;
  --dark-surface: #1e293b;
  --gray-900: #0f172a;
  --gray-800: #1e293b;
  --gray-700: #334155;
  --gray-600: #475569;
  --gray-500: #64748b;
  --gray-400: #94a3b8;
  --gray-300: #cbd5e1;
  --gray-200: #e2e8f0;
  --gray-100: #f1f5f9;
  --gray-50: #f8fafc;
  --white: #ffffff;
  
  --font-main: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
  
  --sidebar-width: 260px;
  --topbar-height: 70px;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
  --radius-2xl: 1.5rem;
  
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-main);
  background-color: #f4f7fe;
  color: var(--gray-800);
  line-height: 1.5;
  overflow-x: hidden;
}

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

/* Sidebar Styling */
.app-sidebar {
  width: var(--sidebar-width);
  background: var(--dark);
  color: var(--white);
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1040;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: 4px 0 25px rgba(0,0,0,0.1);
}

.sidebar-header {
  height: var(--topbar-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand-logo {
  max-height: 40px;
  max-width: 45px;
  object-fit: contain;
  border-radius: var(--radius-sm);
}

.sidebar-brand-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 1.25rem;
}

.sidebar-brand-container {
  overflow: hidden;
  max-width: 175px;
  flex: 1;
  position: relative;
  cursor: pointer;
}

.sidebar-brand-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform;
}

.sidebar-header:hover .sidebar-brand-name,
.sidebar-brand-container:hover .sidebar-brand-name {
  overflow: visible;
  text-overflow: clip;
}

.sidebar-brand-tagline {
  font-size: 0.7rem;
  color: var(--gray-400);
  display: block;
  margin-top: -2px;
}

.sidebar-menu {
  padding: 1.25rem 0.75rem;
  flex: 1;
  overflow-y: auto;
  list-style: none;
}

.menu-label {
  padding: 0.5rem 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-500);
}

.menu-item {
  margin-bottom: 0.25rem;
}

.menu-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: var(--gray-400);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.925rem;
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.menu-link i {
  font-size: 1.1rem;
  width: 20px;
  text-align: center;
}

.menu-link:hover, .menu-link.active {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

.menu-link.active {
  background: linear-gradient(135deg, var(--primary), #3b82f6);
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
  font-weight: 600;
}

/* Sidebar Footer Profile */
.sidebar-footer {
  padding: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0,0,0,0.2);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

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

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

.user-role {
  font-size: 0.725rem;
  color: var(--gray-400);
}

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

/* Top Navbar */
.app-topbar {
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  padding: 0 1.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sidebar-toggle-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--gray-700);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: var(--radius-md);
  display: none;
}

.topbar-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--dark);
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* Main Body Container */
.main-body {
  padding: 1.75rem;
  flex: 1;
}

/* Dynamic Cards & Stat Widgets */
.stat-card {
  background: var(--white);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  border: 1px solid rgba(226, 232, 240, 0.8);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.03);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 15px 30px -5px rgba(0, 0, 0, 0.08);
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.success::before { background: var(--success); }
.stat-card.secondary::before { background: var(--secondary); }
.stat-card.warning::before { background: var(--warning); }

.stat-value {
  font-family: var(--font-heading);
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--dark);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.stat-icon {
  width: 52px;
  height: 52px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}

.stat-icon.primary { background: var(--primary-light); color: var(--primary); }
.stat-icon.success { background: #d1fae5; color: var(--success); }
.stat-icon.secondary { background: #e0f2fe; color: var(--secondary); }
.stat-icon.warning { background: #fef3c7; color: var(--warning); }

/* Standard Modern Card */
.card-custom {
  background: var(--white);
  border-radius: var(--radius-xl);
  border: 1px solid var(--gray-200);
  box-shadow: 0 4px 20px rgba(0,0,0,0.03);
  margin-bottom: 1.5rem;
  overflow: hidden;
}

.card-custom-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--gray-100);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--white);
}

.card-custom-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--dark);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-custom-header.bg-success .card-custom-title,
.card-custom-header.bg-success .card-custom-title i,
.card-custom-header.bg-success .card-custom-title span {
  color: #ffffff !important;
}

.card-custom-body {
  padding: 1.5rem;
}

/* Custom Table Styling */
.table-custom {
  width: 100%;
  margin-bottom: 0;
  vertical-align: middle;
  border-collapse: separate;
  border-spacing: 0;
}

.table-custom th {
  background: var(--gray-50);
  color: var(--gray-600);
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--gray-200);
}

.table-custom td {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-100);
  font-size: 0.9rem;
  color: var(--gray-700);
}

.table-custom tbody tr {
  transition: var(--transition);
}

.table-custom tbody tr:hover {
  background-color: rgba(241, 245, 249, 0.6);
}

/* Action Buttons */
.btn-primary-custom {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.55rem 1.25rem;
  font-weight: 600;
  font-size: 0.875rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.25);
  transition: var(--transition);
}

.btn-primary-custom:hover {
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(79, 70, 229, 0.35);
}

.btn-whatsapp {
  background: #25d366;
  color: var(--white);
  border: none;
  border-radius: var(--radius-md);
  padding: 0.4rem 0.85rem;
  font-size: 0.825rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
}

.btn-whatsapp:hover {
  background: #1da851;
  color: var(--white);
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(37, 211, 102, 0.3);
}

/* Upload Dropzone & Progress Bar */
.upload-dropzone {
  border: 2px dashed var(--primary);
  background: rgba(79, 70, 229, 0.03);
  border-radius: var(--radius-xl);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  background: rgba(79, 70, 229, 0.08);
  border-color: var(--primary-hover);
}

.upload-icon {
  font-size: 2.5rem;
  color: var(--primary);
  margin-bottom: 0.75rem;
}

.upload-text {
  font-weight: 600;
  color: var(--dark);
  font-size: 1rem;
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--gray-500);
  margin-top: 0.25rem;
}

.upload-progress-container {
  display: none;
  margin-top: 1.25rem;
}

.progress-bar-custom {
  height: 8px;
  border-radius: 4px;
  background-color: var(--gray-200);
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transition: width 0.2s ease;
}

.file-preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1rem;
}

.file-preview-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--gray-50);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--gray-200);
  font-size: 0.85rem;
}

.file-preview-item i {
  font-size: 1.1rem;
  margin-right: 0.5rem;
}

/* Badges */
.badge-custom {
  padding: 0.35em 0.75em;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 50rem;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.badge-sent { background: #d1fae5; color: #065f46; }
.badge-failed { background: #fee2e2; color: #991b1b; }
.badge-pdf { background: #fee2e2; color: #b91c1c; }
.badge-image { background: #e0f2fe; color: #0369a1; }

/* Responsive adjustments */
@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }
  .app-sidebar.show {
    transform: translateX(0);
  }
  .app-content {
    margin-left: 0;
  }
  .sidebar-toggle-btn {
    display: block;
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 1035;
  }
  .sidebar-overlay.show {
    display: block;
  }
}
