/* ==========================================================================
   1. ROOT VARIABLES
   ========================================================================== */
:root {
  --primary: #2c5530; /* Green */
  --secondary: #b68d40; /* Gold */
  --light: #f8f9fa;
  --dark: #343a40;
  --gray: #6c757d;
  --white: #ffffff;
  --transition: 0.3s ease;
}

/* ==========================================================================
   2. GLOBAL RESETS & APPLICATION STYLES (Your Original CSS)
   ========================================================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Fix for hidden class */
.hidden {
  display: none !important;
}

/* Login page styling */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-logo {
  text-align: center;
  margin-bottom: 20px;
}

.login-box {
  width: 360px;
}

.healthcare-primary {
  background-color: var(--primary) !important;
}

.healthcare-secondary {
  background-color: var(--secondary) !important;
}

.healthcare-white {
  background-color: var(--white) !important;
}

.healthcare-dark {
  background-color: var(--dark) !important;
}

.healthcare-light {
  background-color: var(--light) !important;
  color: white !important;
}

.sidebar-healthcare {
  background-color: #2c3e50 !important;
}

/* Dashboard Cards */
.dashboard-card {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  border-radius: 10px;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: bold;
  margin: 10px 0;
}

/* User Photo Styles */
.img-circle {
  border-radius: 50% !important;
}

.dropdown-header {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  padding: 20px;
}

/* Form Styling */
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(44, 85, 48, 0.25);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .login-box {
      width: 90%;
  }
  
  .stat-number {
      font-size: 2rem;
  }
}

/* Print Styles for Membership Cards */
@media print {
  body * {
      visibility: hidden;
  }
  .member-card-print, .member-card-print * {
      visibility: visible;
  }
  .member-card-print {
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
  }
}

/* Make Master tabs look like AdminLTE tabs */
#masterTabs .nav-link {
  cursor: pointer;
  padding: 8px 15px;
  font-weight: 500;
  border-radius: 4px;
  color: #444;
  background: #f4f6f9;
  margin-right: 5px;
  border: 1px solid #ddd;
}

#masterTabs .nav-link.active {
  background: #007bff;
  color: #fff;
  border-color: #007bff;
}

/* Responsive table */
#masterContent table {
  width: 100%;
  background: white;
}

#masterContent .table-responsive {
  overflow-x: auto;
}

/* Card padding fixes */
#master .card-body {
  padding: 15px;
}

/* Export button alignment */
#masterContent .btn {
  margin-bottom: 10px;
}

/* Register member footer button */
.btn-outline-warning {
  border-color: #ffc107;
  color: #856404;
}

.btn-outline-warning:hover {
  background-color: #bf0d0d;
  color: #f6f8fa;
}

/* Access Denied Styles */
.access-denied-container {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.access-denied-content {
  max-width: 800px;
  text-align: center;
  padding: 40px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.access-denied-icon {
  font-size: 80px;
  color: #dc3545;
  margin-bottom: 20px;
}

.access-denied-icon i {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.access-denied-content h1 {
  color: #dc3545;
  margin-bottom: 20px;
  font-size: 2.2rem;
}

.access-denied-content .lead {
  font-size: 1.2rem;
  color: #495057;
  margin-bottom: 15px;
}

.access-denied-content p {
  color: #6c757d;
  margin-bottom: 10px;
  line-height: 1.6;
}

/* Permission badges in list */
.permission-badge {
  font-size: 0.8rem;
  padding: 3px 8px;
  margin-left: 5px;
}

.permission-badge.admin { background-color: #dc3545; color: white; }
.permission-badge.coordinator { background-color: #007bff; color: white; }
.permission-badge.health_worker { background-color: #28a745; color: white; }
.permission-badge.accountant { background-color: #ffc107; color: black; }
.permission-badge.employee { background-color: #6c757d; color: white; }

/* ==================== SIDEBAR FIXES ==================== */
@media (max-width: 767.98px) {
  .sidebar {
      margin-left: -250px;
      transition: margin-left 0.3s ease-in-out;
  }
  
  .sidebar-open .sidebar { margin-left: 0; }
  
  .content-wrapper, .main-footer { margin-left: 0 !important; }
  
  .sidebar-open::before {
      content: '';
      position: fixed;
      top: 0; left: 0; right: 0; bottom: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 1030;
  }
  
  .sidebar { z-index: 1031; }
}

@media (min-width: 768px) {
  .main-sidebar {
      transition: margin-left 0.3s ease-in-out !important;
      -webkit-transition: margin-left 0.3s ease-in-out !important;
      -o-transition: margin-left 0.3s ease-in-out !important;
  }
  
  .content-wrapper, .main-footer {
      transition: margin-left 0.3s ease-in-out !important;
      -webkit-transition: margin-left 0.3s ease-in-out !important;
      -o-transition: margin-left 0.3s ease-in-out !important;
  }
  
  .sidebar-collapse .main-sidebar { margin-left: -250px !important; }
  .sidebar-collapse .content-wrapper, .sidebar-collapse .main-footer { margin-left: 0 !important; }
  .main-sidebar:not(.sidebar-collapse) { margin-left: 0 !important; }
  .sidebar-collapse .content-wrapper { width: 100% !important; margin-left: 0 !important; }
  .sidebar-collapse .main-footer { width: 100% !important; margin-left: 0 !important; }
}

.layout-fixed .main-sidebar {
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
}

.main-sidebar { z-index: 1038 !important; }

/* ==========================================================================
   3. HEADER STYLES
   ========================================================================== */
.phs-header { background: var(--white); padding: 15px 0; position: fixed; top: 0; left: 0; right: 0; z-index: 1000; box-shadow: 0 2px 20px rgba(44, 85, 48, 0.1); transition: all 0.3s ease; }
.phs-header.scrolled { padding: 10px 0; box-shadow: 0 5px 25px rgba(44, 85, 48, 0.15); backdrop-filter: blur(10px); background: rgba(255, 255, 255, 0.95); }
.phs-header-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: flex; justify-content: space-between; align-items: center; }

/* Logo Styles */
.phs-logo { display: flex; align-items: center; gap: 12px; text-decoration: none; transition: transform 0.3s ease; }
.phs-logo:hover { transform: translateY(-2px); }
.phs-logo-icon { width: 45px; height: 45px; display: flex; align-items: center; justify-content: center; }
.phs-logo-icon img { width: 100%; height: 100%; object-fit: contain; transition: all 0.3s ease; }
.phs-logo:hover .phs-logo-icon img { transform: scale(1.1); }
.phs-logo-text h1 { font-size: 1.4rem; margin-bottom: 3px; font-weight: 700; color: var(--primary); line-height: 1.2; }
.phs-logo-text p { font-size: 0.75rem; color: var(--gray); margin: 0; font-weight: 500; }

/* Desktop Navigation */
.phs-main-nav ul { display: flex; list-style: none; margin: 0; padding: 0; gap: 8px; }
.nav-link { position: relative; color: var(--primary); text-decoration: none; font-weight: 600; padding: 10px 18px; border-radius: 8px; overflow: hidden; transition: all 0.3s ease; display: block; font-size: 0.95rem; }
.nav-text { position: relative; z-index: 2; }
.nav-hover { position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(135deg, var(--primary) 0%, #1e3a22 100%); transition: all 0.4s ease; z-index: 1; border-radius: 8px; }
.nav-link:hover, .nav-link.active { color: var(--white); transform: translateY(-2px); }
.nav-link:hover .nav-hover, .nav-link.active .nav-hover { left: 0; }

/* CTA Button */
.phs-header-actions { margin-left: 15px; }
.phs-cta-button { position: relative; display: inline-block; background: linear-gradient(135deg, var(--primary) 0%, #1e3a22 100%); color: var(--white); padding: 12px 24px; border-radius: 50px; text-decoration: none; font-weight: 600; overflow: hidden; transition: all 0.4s ease; box-shadow: 0 4px 15px rgba(44, 85, 48, 0.3); font-size: 0.95rem; }
.btn-text { position: relative; z-index: 2; }
.btn-hover-effect { position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(135deg, #1e3a22 0%, var(--primary) 100%); transition: all 0.4s ease; z-index: 1; border-radius: 50px; }
.phs-cta-button:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(44, 85, 48, 0.4); color: white;}
.phs-cta-button:hover .btn-hover-effect { left: 0; }

/* Scroll Progress */
.scroll-progress { position: absolute; bottom: 0; left: 0; width: 100%; height: 3px; background: rgba(44, 85, 48, 0.1); }
.scroll-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); width: 0%; transition: width 0.1s ease; border-radius: 0 2px 2px 0; }

/* Mobile Menu Button */
.phs-mobile-menu-btn { display: none; flex-direction: column; background: none; border: none; cursor: pointer; padding: 8px; gap: 4px; }
.menu-bar { width: 25px; height: 3px; background: var(--primary); border-radius: 2px; transition: all 0.3s ease; }
.phs-mobile-menu-btn.active .menu-bar:nth-child(1) { transform: rotate(45deg) translate(6px, 6px); }
.phs-mobile-menu-btn.active .menu-bar:nth-child(2) { opacity: 0; }
.phs-mobile-menu-btn.active .menu-bar:nth-child(3) { transform: rotate(-45deg) translate(6px, -6px); }

/* Mobile Side Navigation */
.phs-mobile-nav-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.5); z-index: 9998; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.phs-mobile-nav-overlay.active { opacity: 1; visibility: visible; }
.phs-mobile-nav { position: fixed; top: 0; right: -100%; width: 320px; height: 100%; background: var(--white); z-index: 9999; transition: all 0.4s ease; box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1); display: flex; flex-direction: column; }
.phs-mobile-nav.active { right: 0; }
.mobile-nav-header { padding: 25px; border-bottom: 1px solid #eee; display: flex; justify-content: space-between; align-items: center; background: #f8f9fa; }
.mobile-logo { display: flex; align-items: center; gap: 12px; }
.mobile-logo-icon { width: 40px; height: 40px; }
.mobile-logo-icon img { width: 100%; height: 100%; object-fit: contain; }
.mobile-logo-text h3 { font-size: 1.1rem; margin-bottom: 2px; color: var(--primary); font-weight: 700; }
.mobile-logo-text p { font-size: 0.7rem; color: var(--gray); margin: 0; }
.mobile-nav-close { background: rgba(44, 85, 48, 0.1); border: none; font-size: 1.3rem; color: var(--primary); cursor: pointer; padding: 5px; transition: all 0.3s ease; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; }
.mobile-nav-close:hover { transform: rotate(90deg); background: var(--primary); color: var(--white); }
.mobile-nav-content { flex: 1; display: flex; flex-direction: column; padding: 20px 0; overflow-y: auto; }
.mobile-nav-menu { list-style: none; margin: 0; padding: 0; }
.mobile-nav-link { display: flex; align-items: center; gap: 15px; padding: 16px 25px; color: var(--primary); text-decoration: none; font-weight: 600; transition: all 0.3s ease; border-left: 4px solid transparent; font-size: 0.95rem; }
.mobile-nav-link:hover, .mobile-nav-link.active { background: rgba(44, 85, 48, 0.05); border-left-color: var(--primary); padding-left: 30px; }
.mobile-nav-link i { width: 20px; text-align: center; font-size: 1.1rem; color: var(--secondary); }
.mobile-nav-footer { padding: 25px; border-top: 1px solid #eee; display: flex; flex-direction: column; gap: 20px; }
.mobile-cta-button { display: flex; align-items: center; justify-content: center; gap: 10px; background: linear-gradient(135deg, var(--primary) 0%, #1e3a22 100%); color: var(--white); padding: 14px; border-radius: 10px; text-decoration: none; font-weight: 600; transition: all 0.3s ease; text-align: center; font-size: 0.95rem; }
.mobile-contact-info { display: flex; flex-direction: column; gap: 12px; }
.mobile-contact-item { display: flex; align-items: center; gap: 10px; color: var(--gray); font-size: 0.85rem; }
.mobile-contact-item i { color: var(--secondary); width: 16px; }

@media (max-width: 1024px) {
  .phs-main-nav, .phs-header-actions { display: none; }
  .phs-mobile-menu-btn { display: flex; }
}
@media (max-width: 768px) {
  .phs-logo-text h1 { font-size: 1rem; }
  .phs-logo-text p { display: none; }
}

/* ==========================================================================
   4. FOOTER STYLES 
   ========================================================================== */
footer { background: var(--primary); color: var(--white); padding: 60px 0 20px; margin-top: 80px; width: 100%; position: relative; overflow: hidden; }
footer .container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
.footer-content { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 40px; margin-bottom: 40px; width: 100%; }
.footer-column { margin-bottom: 30px; }
.footer-column h3 { font-size: 1.3rem; margin-bottom: 20px; color: var(--white); position: relative; padding-bottom: 10px; }
.footer-column h3::after { content: ""; position: absolute; left: 0; bottom: 0; width: 50px; height: 2px; background: var(--secondary); }
.footer-column p { margin-bottom: 20px; opacity: 0.9; line-height: 1.6; color: rgba(255, 255, 255, 0.8); }
.footer-column ul { list-style: none; padding: 0; margin: 0; }
.footer-column ul li { margin-bottom: 12px; transition: var(--transition); }
.footer-column ul li:hover { transform: translateX(5px); }
.footer-column ul li a { color: rgba(255, 255, 255, 0.9); text-decoration: none; transition: var(--transition); display: flex; align-items: center; gap: 8px; }
.footer-column ul li a:hover { color: var(--secondary); }
.footer-column ul.footer-links li { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 15px; color: rgba(255, 255, 255, 0.9); }
.footer-column ul.footer-links li i { margin-top: 4px; flex-shrink: 0; color: var(--secondary); }

.social-links { display: flex; gap: 15px; margin-top: 25px; }
.social-links a { width: 40px; height: 40px; background: rgba(255, 255, 255, 0.2); display: flex; align-items: center; justify-content: center; border-radius: 50%; transition: var(--transition); color: var(--white); text-decoration: none; }
.social-links a:hover { background: var(--secondary); transform: translateY(-3px); }

.copyright { text-align: center; padding-top: 20px; border-top: 1px solid rgba(255, 255, 255, 0.1); font-size: 0.9rem; opacity: 0.8; width: 100%; }
.copyright a { color: var(--secondary); text-decoration: none; transition: var(--transition); }
.copyright a:hover { color: #fff; text-decoration: underline; }

@media (max-width: 768px) {
  .footer-content { grid-template-columns: 1fr; gap: 30px; text-align: center; }
  .footer-column h3::after { left: 50%; transform: translateX(-50%); }
  .footer-column ul li a, .footer-column ul.footer-links li { justify-content: center; text-align: center; }
  .social-links { justify-content: center; }
}

/* ==========================================================================
   5. LAYOUT FIXES
   ========================================================================== */
/* Adjust main content padding to account for the fixed public header */
.main-content { padding-top: 90px; }