/* TraumaCare Volunteer Management System - Modern UI Stylesheet */

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

:root {
  --primary-navy: #0f172a;
  --navy-light: #1e293b;
  --navy-hover: #334155;
  --trauma-red: #dc2626;
  --trauma-red-hover: #b91c1c;
  --trauma-red-light: #fef2f2;
  --medical-teal: #0d9488;
  --medical-teal-light: #f0fdfa;
  --amber-gold: #f59e0b;
  --amber-light: #fffbeb;
  --emerald-green: #10b981;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1.25rem;
  --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 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
  --shadow-glow: 0 0 20px rgba(220, 38, 38, 0.25);
}

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

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background-color: #f4f6f9;
  color: var(--slate-800);
  line-height: 1.5;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  color: var(--slate-900);
}

a {
  color: var(--trauma-red);
  text-decoration: none;
  transition: all 0.2s ease;
}

a:hover {
  color: var(--trauma-red-hover);
}

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

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  box-shadow: 4px 0 15px rgba(0,0,0,0.1);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

.brand-emblem {
  width: 44px;
  height: 44px;
  background: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
  color: #fff;
  font-size: 1.5rem;
  overflow: hidden;
  padding: 2px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.brand-emblem img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 50% !important;
  display: block !important;
}

.brand-text h2 {
  font-size: 1.25rem;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.brand-text p {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.sidebar-nav {
  padding: 1.25rem 0.85rem;
  flex: 1;
  overflow-y: auto;
}

.nav-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #64748b;
  margin: 1.25rem 0.75rem 0.5rem;
  font-weight: 700;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: #cbd5e1;
  border-radius: var(--radius-md);
  font-weight: 500;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
  transition: all 0.2s ease;
}

.nav-link i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
}

.nav-link:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  transform: translateX(3px);
}

.nav-link.active {
  background: linear-gradient(90deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
}

/* Main Content Area */
.main-wrapper {
  margin-left: 280px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  height: 70px;
  background: #ffffff;
  border-bottom: 1px solid var(--slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
}

.page-header-title h1 {
  font-size: 1.4rem;
  color: var(--slate-900);
}

.page-header-title p {
  font-size: 0.82rem;
  color: var(--slate-600);
}

.user-profile-menu {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0.85rem;
  background: var(--slate-100);
  border-radius: 50px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--trauma-red);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}

.content-body {
  padding: 2rem;
  flex: 1;
}

/* Cards & Components */
.card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: all 0.25s ease;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
  box-sizing: border-box;
}

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

.card-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--slate-100);
  min-width: 0;
}

.card-title-bar > div,
.card-title-bar h1,
.card-title-bar h2,
.card-title-bar h3,
.card-title-bar h4 {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

/* KPI Summary Widgets */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
  min-width: 0;
  max-width: 100%;
}

.kpi-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}

.stat-card {
  background: #ffffff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--slate-200);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

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

.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--trauma-red);
}

.kpi-card.teal::before { background: var(--medical-teal); }
.kpi-card.amber::before { background: var(--amber-gold); }
.kpi-card.green::before { background: var(--emerald-green); }

.kpi-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--trauma-red-light);
  color: var(--trauma-red);
}

.kpi-card.teal .kpi-icon { background: var(--medical-teal-light); color: var(--medical-teal); }
.kpi-card.amber .kpi-icon { background: var(--amber-light); color: var(--amber-gold); }
.kpi-card.green .kpi-icon { background: #ecfdf5; color: var(--emerald-green); }

.kpi-info h3 {
  font-size: 1.75rem;
  line-height: 1;
  margin-bottom: 0.25rem;
}

.kpi-info p {
  font-size: 0.82rem;
  color: var(--slate-600);
  font-weight: 500;
}

/* Category Progress Pill Badges */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.65rem;
  border-radius: 50px;
  font-size: 0.75rem;
  font-weight: 600;
}

.category-badge.done {
  background: #dcfce7;
  color: #15803d;
}

.category-badge.pending {
  background: #fef3c7;
  color: #b45309;
}

/* Data Tables */
.table-responsive {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-bottom: 1.5rem;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
  word-break: normal;
  overflow-wrap: normal;
}

.custom-table th {
  background: var(--slate-100);
  color: var(--slate-700);
  padding: 0.85rem 1rem;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--slate-200);
  white-space: nowrap;
  word-break: normal;
}

.custom-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--slate-100);
  vertical-align: middle;
  word-break: normal;
}

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

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.25rem;
  font-size: 0.88rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  color: #ffffff !important;
  box-shadow: 0 4px 10px rgba(220, 38, 38, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #b91c1c 0%, #991b1b 100%);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--navy-light);
  color: #ffffff !important;
}

.btn-secondary:hover {
  background: var(--navy-hover);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--slate-300);
  color: var(--slate-700) !important;
}

.btn-outline:hover {
  background: var(--slate-100);
}

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
  color: var(--slate-800);
}

.form-control, .form-select {
  width: 100%;
  padding: 0.65rem 0.9rem;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--slate-300);
  border-radius: var(--radius-md);
  background-color: #ffffff;
  transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
  outline: none;
  border-color: var(--trauma-red);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

/* CR80 PVC ID Card Layout (85.6mm x 53.98mm Ratio) */
.id-card-container {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 2rem 0;
}

.id-card {
  width: 340px;
  height: 530px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.15);
  border: 1px solid var(--slate-300);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Large Center Watermark Emblem */
.id-card-watermark {
  position: absolute;
  top: 55%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 220px !important;
  height: 220px !important;
  max-width: 220px !important;
  max-height: 220px !important;
  opacity: 0.10;
  pointer-events: none;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden !important;
  border-radius: 50% !important;
  -webkit-print-color-adjust: exact !important;
  print-color-adjust: exact !important;
}

.id-card-watermark img {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  border-radius: 50% !important;
  display: block !important;
}

.id-card-header,
.id-card-body,
.id-card-footer {
  position: relative;
  z-index: 2;
}

.id-card-header {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
  color: #ffffff;
  padding: 0.75rem 1rem;
  text-align: center;
  position: relative;
  border-bottom: 4px solid var(--trauma-red);
  flex-shrink: 0;
}

.id-card-header h3 {
  color: #ffffff;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.id-card-header p {
  font-size: 0.68rem;
  color: #f87171;
  font-weight: 600;
  letter-spacing: 1px;
}

.id-card-body {
  padding: 0.75rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  text-align: center;
  overflow: hidden;
}

.volunteer-photo-wrap {
  width: 95px;
  height: 95px;
  border-radius: 12px;
  overflow: hidden;
  border: 3px solid var(--trauma-red);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  margin-bottom: 0.4rem;
  background: var(--slate-100);
  flex-shrink: 0;
}

.volunteer-photo-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.volunteer-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--slate-900);
  line-height: 1.2;
}

.volunteer-id-code {
  display: inline-block;
  background: var(--trauma-red-light);
  color: var(--trauma-red);
  padding: 0.15rem 0.65rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 0.78rem;
  margin: 0.25rem 0 0.5rem;
}

.id-card-details {
  width: 100%;
  font-size: 0.78rem;
  text-align: left;
  border-top: 1px solid var(--slate-200);
  padding-top: 0.4rem;
}

.id-card-details .row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}

.id-card-details .label {
  color: var(--slate-600);
  font-weight: 600;
}

.id-card-details .val {
  font-weight: 700;
  color: var(--slate-900);
}

.category-badges-row {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
  justify-content: center;
  width: 100%;
}

.cat-pill {
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.id-card-footer {
  background: var(--slate-100);
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-top: 1px solid var(--slate-200);
  font-size: 0.7rem;
  color: var(--slate-600);
  margin-top: auto;
  flex-shrink: 0;
}

/* Sidebar Navigation Drawer Controls */
.mobile-sidebar-toggle-btn {
  display: inline-flex !important;
  background: var(--slate-100);
  border: 1px solid var(--slate-200);
  color: var(--slate-800);
  width: 40px;
  height: 40px;
  border-radius: var(--radius-md);
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.mobile-sidebar-toggle-btn:hover {
  background: var(--trauma-red-light);
  color: var(--trauma-red);
}

.mobile-sidebar-close-btn {
  display: none;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #ffffff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  margin-left: auto;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1040;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-backdrop.active {
  display: block;
  opacity: 1;
}

/* Desktop Collapsed Sidebar Mode (>1024px) */
@media (min-width: 1025px) {
  .sidebar-collapsed .sidebar,
  .sidebar.collapsed {
    width: 72px !important;
    overflow: hidden;
  }

  .sidebar-collapsed .sidebar .brand-text,
  .sidebar.collapsed .brand-text,
  .sidebar-collapsed .sidebar .nav-section-title,
  .sidebar.collapsed .nav-section-title,
  .sidebar-collapsed .sidebar .nav-link span,
  .sidebar.collapsed .nav-link span {
    display: none !important;
  }

  .sidebar-collapsed .sidebar .sidebar-header,
  .sidebar.collapsed .sidebar-header {
    padding: 1.25rem 0.5rem;
    justify-content: center;
  }

  .sidebar-collapsed .sidebar .brand-emblem,
  .sidebar.collapsed .brand-emblem {
    width: 38px;
    height: 38px;
  }

  .sidebar-collapsed .sidebar .nav-link,
  .sidebar.collapsed .nav-link {
    justify-content: center;
    padding: 0.75rem 0.5rem;
    margin-bottom: 0.35rem;
  }

  .sidebar-collapsed .sidebar .nav-link i,
  .sidebar.collapsed .nav-link i {
    font-size: 1.35rem;
    margin: 0;
  }

  .sidebar-collapsed .main-wrapper,
  .sidebar-collapsed main.main-wrapper {
    margin-left: 72px !important;
  }
}

/* Responsive Grid Utility Classes */
.responsive-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  min-width: 0;
  max-width: 100%;
}

.filter-grid-4 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  align-items: flex-end;
  min-width: 0;
  max-width: 100%;
}

@media (min-width: 1200px) {
  .filter-grid-4 {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.profile-grid-2 {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  align-items: start;
  min-width: 0;
  max-width: 100%;
}

/* Intermediate Screen Sizing (1025px - 1280px) */
@media (min-width: 1025px) and (max-width: 1280px) {
  .responsive-grid-2 {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
}

/* Global Responsive Breakpoints: Desktops, Laptops, iPads & Mobile Phones */

/* Tablets & iPads (<= 1024px) */
@media (max-width: 1024px) {
  .mobile-sidebar-toggle-btn {
    display: inline-flex !important;
  }

  .mobile-sidebar-close-btn {
    display: inline-flex !important;
  }

  .sidebar {
    width: 280px;
    max-width: 85vw;
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    z-index: 1050;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.4);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-wrapper {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    overflow-x: hidden;
  }

  .topbar {
    height: auto;
    min-height: 64px;
    padding: 0.5rem 1rem;
  }

  .user-details-text {
    display: none !important;
  }

  .hide-on-mobile {
    display: none !important;
  }

  .content-body {
    padding: 1.25rem 1rem;
  }

  .table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
    border: 1px solid var(--slate-200);
    margin-bottom: 1.5rem;
  }

  .responsive-grid-2,
  .filter-grid-4,
  .profile-grid-2,
  .grid-2,
  .grid-3,
  .grid-4,
  .form-grid {
    grid-template-columns: 1fr !important;
    gap: 1rem !important;
  }
}

/* Mobile Devices & Phones (<= 768px) */
@media (max-width: 768px) {
  .topbar {
    min-height: 60px;
    padding: 0.4rem 0.75rem;
  }

  .page-header-title h1 {
    font-size: 1.1rem;
    line-height: 1.2;
  }

  .page-header-title p {
    display: none;
  }

  .user-profile-menu {
    gap: 0.4rem;
  }

  .content-body {
    padding: 0.85rem 0.65rem;
  }

  .card {
    padding: 1rem;
    border-radius: var(--radius-md);
  }

  .card-title-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  /* Form & Input Optimizations for Touch Screens */
  input[type="text"],
  input[type="number"],
  input[type="email"],
  input[type="date"],
  select,
  textarea {
    font-size: 16px !important; /* Prevents auto-zoom on iOS safari */
    min-height: 44px;
  }

  .btn {
    min-height: 42px;
    font-size: 0.88rem;
  }
}

/* Extra Small Phones (<= 480px) */
@media (max-width: 480px) {
  .topbar {
    padding: 0.4rem 0.5rem;
  }

  .user-badge {
    padding: 0.2rem;
    background: transparent;
  }

  .modal-content, .quick-edit-modal {
    width: 95vw !important;
    padding: 1rem !important;
    max-height: 90vh !important;
    overflow-y: auto !important;
  }

  .filter-bar, .search-bar-wrap {
    flex-direction: column;
    align-items: stretch !important;
    gap: 0.75rem !important;
  }

  .filter-bar input, .filter-bar select, .filter-bar button {
    width: 100% !important;
  }
}

/* Print Specific Rules */
@media print {
  body {
    background: #ffffff !important;
  }
  .sidebar, .topbar, .btn, .no-print, .mobile-sidebar-toggle-btn, .sidebar-backdrop {
    display: none !important;
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
  .content-body {
    padding: 0 !important;
  }
  .id-card {
    box-shadow: none !important;
    border: 1px solid #000 !important;
    page-break-inside: avoid;
  }
}
