:root {
  --primary-color: #1e3a5f; /* Navy blue matching Toowoomba Touch */
  --secondary-color: #2c5282; /* Slightly lighter navy for accents */
  --accent-color: #3b82c4; /* Brighter blue for hover states */
  --success-color: #059669; /* Green for success */
  --danger-color: #dc2626; /* Red for danger */
  --warning-color: #f59e0b; /* Orange for warning */
  --text-color: #1f2937; /* Dark gray text */
  --text-light: #6b7280; /* Light gray text */
  --bg-light: #f9fafb; /* Light background */
  --border-color: #e5e7eb; /* Border gray */
  --shadow: 0 2px 10px rgba(0,0,0,0.1);
  --shadow-hover: 0 4px 20px rgba(0,0,0,0.15);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

body {
  margin-bottom: 60px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #fff;
}

/* Navigation - Navy Blue Theme */
.navbar {
  background-color: var(--primary-color) !important;
  padding: 1rem 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  position: relative;
  z-index: 1030;
}

/* Ensure navbar collapse and its contents have proper z-index */
.navbar-collapse {
  position: relative;
  z-index: 1031;
}

/* Ensure header and nav containers don't clip dropdowns */
header.sticky-header,
header.sticky-header .navbar,
header.sticky-header .container {
  overflow: visible !important;
}

/* Ensure dropdown parent items have proper positioning */
.navbar-nav .nav-item.dropdown {
  position: relative;
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.75rem;
  color: #ffffff !important;
  text-decoration: none;
}

.navbar-brand:hover {
  color: #ffffff !important;
  text-decoration: none;
}

.navbar-nav .nav-link {
  color: #ffffff !important;
  font-weight: 500;
  padding: 0.75rem 1rem !important;
  border-radius: 6px;
  transition: all 0.3s ease;
  text-decoration: none;
}

.navbar-nav .nav-link:hover {
  color: #ffffff !important;
  background-color: rgba(255,255,255,0.2) !important;
  text-decoration: none;
}

.navbar-nav .nav-link.dropdown-toggle {
  color: #ffffff !important;
}

.navbar-nav .nav-link.dropdown-toggle:hover {
  color: #ffffff !important;
  background-color: rgba(255,255,255,0.2) !important;
}

.navbar-nav .dropdown-toggle::after {
  border-top-color: #ffffff !important;
}

.navbar-toggler {
  border: none;
  padding: 4px 8px;
}

.navbar-toggler:focus {
  box-shadow: none;
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255, 255, 255, 0.75%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

.dropdown-menu {
  border: 1px solid #ccc !important;
  box-shadow: var(--shadow);
  border-radius: 8px;
  background-color: #ffffff !important;
}

.dropdown-item {
  padding: 0.75rem 1.25rem;
  font-weight: 500;
  color: #333333 !important;
  background-color: #ffffff !important;
}

.dropdown-item:hover, .dropdown-item:focus {
  background-color: #f8f9fa !important;
  color: #333333 !important;
}

.dropdown-header {
  color: #666666 !important;
  font-weight: 600;
  font-size: 0.875rem;
  background-color: #ffffff !important;
}

/* Force dropdown styling to override Bootstrap */
.navbar .dropdown-menu {
  background-color: #ffffff !important;
  border: 1px solid #dee2e6 !important;
}

.navbar .dropdown-menu .dropdown-item {
  color: #212529 !important;
  background-color: transparent !important;
}

.navbar .dropdown-menu .dropdown-item:hover,
.navbar .dropdown-menu .dropdown-item:focus {
  color: #16181b !important;
  background-color: #e9ecef !important;
}

.navbar .dropdown-menu .dropdown-header {
  color: #6c757d !important;
}

/* Make ALL dropdowns use the same blue theme as profile dropdown */
.navbar-nav .dropdown-menu,
.nav-item .dropdown-menu,
.dropdown .dropdown-menu {
  background: #1e3a5f !important;
  border: 1px solid #163a5f !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
  z-index: 9999 !important; /* Ensure dropdowns appear above all page content including cards */
  position: absolute !important;
}

/* Extra specificity for shown dropdowns */
.navbar .dropdown-menu.show,
.navbar-nav .dropdown-menu.show,
.nav-item .dropdown-menu.show {
  z-index: 99999 !important;
  position: absolute !important;
}

/* Override user dropdown to have blue theme */
#userDropdown + .dropdown-menu {
  background: #1e3a5f !important;
  border: 1px solid #163a5f !important;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15) !important;
}

#userDropdown + .dropdown-menu .dropdown-item {
  background-color: transparent !important;
  color: white !important;
  border-color: transparent !important;
}

#userDropdown + .dropdown-menu .dropdown-item:hover,
#userDropdown + .dropdown-menu .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: white !important;
}

#userDropdown + .dropdown-menu .dropdown-item.active {
  background-color: rgba(255, 255, 255, 0.2) !important;
  color: white !important;
}

#userDropdown + .dropdown-menu .dropdown-header {
  background-color: transparent !important;
  color: rgba(255, 255, 255, 0.8) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
  margin-bottom: 0.5rem !important;
}

#userDropdown + .dropdown-menu .dropdown-header i,
#userDropdown + .dropdown-menu .dropdown-header small {
  color: rgba(255, 255, 255, 0.8) !important;
}

#userDropdown + .dropdown-menu .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.2) !important;
}

#userDropdown + .dropdown-menu .dropdown-item i {
  color: white !important;
}

#userDropdown + .dropdown-menu .dropdown-item .text-success {
  color: #51cf66 !important;
}

.navbar-nav .dropdown-menu .dropdown-item,
.nav-item .dropdown-menu .dropdown-item,
.dropdown .dropdown-menu .dropdown-item {
  color: white !important;
  background: transparent !important;
  text-decoration: none !important;
}

.navbar-nav .dropdown-menu .dropdown-item:hover,
.nav-item .dropdown-menu .dropdown-item:hover,
.dropdown .dropdown-menu .dropdown-item:hover {
  color: white !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

.navbar-nav .dropdown-menu .dropdown-header,
.nav-item .dropdown-menu .dropdown-header,
.dropdown .dropdown-menu .dropdown-header {
  color: rgba(255, 255, 255, 0.8) !important;
  background: transparent !important;
  font-weight: 600 !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
  margin-bottom: 0.5rem !important;
}

.navbar-nav .dropdown-menu .dropdown-divider,
.nav-item .dropdown-menu .dropdown-divider,
.dropdown .dropdown-menu .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.2) !important;
}

.navbar-nav .dropdown-menu .dropdown-item i,
.nav-item .dropdown-menu .dropdown-item i,
.dropdown .dropdown-menu .dropdown-item i {
  color: white !important;
}

/* Hero Section */
.hero-section {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--accent-color) 100%);
  color: white;
  padding: 4rem 0;
  text-align: center;
  margin: -1rem -15px 3rem -15px;
}

.hero-content h1 {
  font-size: 3rem;
  font-weight: 700;
  margin-bottom: 1rem;
}

.hero-content .lead {
  font-size: 1.25rem;
  margin-bottom: 2rem;
  opacity: 0.9;
}

.auth-actions,
.dashboard-actions {
  margin-top: 2rem;
}

.auth-actions .btn,
.dashboard-actions .btn {
  margin: 0 0.5rem;
  padding: 0.75rem 2rem;
  font-weight: 600;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.btn-primary:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  transform: translateY(-2px);
  color: #fff;
}

.btn-secondary {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: #fff;
}

.btn-secondary:hover {
  background-color: var(--accent-color);
  border-color: var(--accent-color);
  color: #fff;
}

.btn-outline-primary {
  color: var(--primary-color);
  border-color: var(--primary-color);
  background-color: transparent;
}

.btn-outline-primary:hover {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
  color: #fff;
}

.btn-outline-secondary {
  color: var(--secondary-color);
  border-color: var(--secondary-color);
  background-color: transparent;
}

.btn-outline-secondary:hover {
  background-color: var(--secondary-color);
  border-color: var(--secondary-color);
  color: #fff;
}

.btn-light {
  background-color: var(--bg-light);
  border-color: var(--border-color);
  color: var(--text-color);
}

.btn-light:hover {
  background-color: #fff;
  border-color: var(--secondary-color);
  color: var(--primary-color);
}

.btn-success {
  background-color: var(--success-color);
  border-color: var(--success-color);
  color: #fff;
}

.btn-success:hover {
  background-color: #047857;
  border-color: #047857;
  color: #fff;
}

.btn-danger {
  background-color: var(--danger-color);
  border-color: var(--danger-color);
  color: #fff;
}

.btn-danger:hover {
  background-color: #b91c1c;
  border-color: #b91c1c;
  color: #fff;
}

.btn-warning {
  background-color: var(--warning-color);
  border-color: var(--warning-color);
  color: #fff;
}

.btn-warning:hover {
  background-color: #d97706;
  border-color: #d97706;
  color: #fff;
}

/* Features Section */
.features-section {
  padding: 3rem 0;
}

.feature-card {
  text-align: center;
  padding: 2rem;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  margin-bottom: 2rem;
  height: 100%;
}

.feature-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-hover);
}

.feature-icon {
  font-size: 3rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.feature-card h3 {
  color: var(--text-color);
  font-weight: 600;
  margin-bottom: 1rem;
}

.feature-card p {
  color: var(--text-light);
  line-height: 1.6;
}

/* Forms */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  font-weight: 500;
  color: var(--text-color);
  margin-bottom: 0.5rem;
  display: block;
}

.form-control {
  padding: 0.75rem;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  font-size: 1rem;
  transition: all 0.3s ease;
  background-color: #fff;
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(44, 90, 160, 0.25);
}

.form-check {
  margin: 1rem 0;
}

.form-check-input:checked {
  background-color: var(--primary-color);
  border-color: var(--primary-color);
}

.btn-block {
  width: 100%;
  padding: 0.75rem;
  font-weight: 600;
  border-radius: 8px;
  margin-top: 1rem;
}

/* Alerts */
.alert {
  border: none;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.alert-danger {
  background-color: #f8d7da;
  color: #721c24;
}

.text-danger {
  color: #dc3545 !important;
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Footer */
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  background-color: var(--secondary-color);
  border-top: 1px solid var(--border-color);
}

/* Focus states */
.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.2rem rgba(44, 90, 160, 0.25);
}

/* Responsive design */
@media (max-width: 768px) {
  .hero-content h1 {
    font-size: 2rem;
  }
  
  .auth-actions .btn,
  .dashboard-actions .btn {
    display: block;
    width: 100%;
    margin: 0.5rem 0;
  }
  
  .navbar-nav {
    text-align: center;
  }
  
  .hero-section {
    padding: 2rem 0;
  }
}

/* Notification Styles */
.notification-dropdown {
    width: 380px;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.notification-item {
    padding: 12px 16px;
    border-bottom: 1px solid #f8f9fa;
    cursor: pointer;
    transition: background-color 0.2s;
}

.notification-item:hover {
    background-color: #f8f9fa;
}

.notification-item.unread {
    background-color: #e3f2fd;
    border-left: 3px solid #2196f3;
}

.notification-item.read {
    opacity: 0.8;
}

.notification-title {
    font-size: 14px;
    color: #212529;
    margin-bottom: 4px;
}

.notification-message {
    font-size: 12px;
    line-height: 1.4;
    margin-bottom: 4px;
}

.notification-time {
    font-size: 11px;
    color: #6c757d;
}

.notification-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
}

.notification-priority {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Notification Bell Animation */
.nav-link .fa-bell {
    font-size: 18px;
    color: #6c757d;
    transition: color 0.2s;
}

.nav-link:hover .fa-bell {
    color: #2196f3;
}

@keyframes bell-ring {
    0% { transform: rotate(0deg); }
    10% { transform: rotate(10deg); }
    20% { transform: rotate(-10deg); }
    30% { transform: rotate(10deg); }
    40% { transform: rotate(-10deg); }
    50% { transform: rotate(0deg); }
    100% { transform: rotate(0deg); }
}

.notification-bell-active .fa-bell {
    animation: bell-ring 1s ease-in-out;
    color: #ff6b6b !important;
}

/* Notification Badge */
.badge.rounded-pill {
    font-size: 10px;
    padding: 4px 6px;
    min-width: 18px;
}

/* Dashboard Notification Styles */
.notification-card {
    border-left: 4px solid #2196f3;
    transition: transform 0.2s, box-shadow 0.2s;
}

.notification-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.notification-card.urgent {
    border-left-color: #f44336;
}

.notification-card.high {
    border-left-color: #ff9800;
}

.notification-card.normal {
    border-left-color: #4caf50;
}

.notification-card.low {
    border-left-color: #9e9e9e;
}

/* Import Page Styles */
.card {
    background-color: #fff;
    color: var(--text-color);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.card-header {
    background-color: var(--primary-color);
    color: #fff;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
}

.table {
    color: var(--text-color);
    background-color: #fff;
}

.table th {
    color: var(--text-color);
    background-color: var(--secondary-color);
    border-bottom: 2px solid var(--border-color);
}

.table td {
    color: var(--text-color);
    background-color: #fff;
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.badge-success {
    background-color: #28a745;
    color: #fff;
}

.badge-secondary {
    background-color: #6c757d;
    color: #fff;
}

.text-muted {
    color: #6c757d !important;
}

/* Ensure all text is visible on import pages only */
.import-page body, .import-page .container, .import-page .container-fluid {
    color: var(--text-color);
    background-color: #fff;
}

.import-page h1, .import-page h2, .import-page h3, .import-page h4, .import-page h5, .import-page h6 {
    color: var(--text-color);
}

.import-page small {
    color: var(--text-light);
}

/* Import mapping table styles */
.import-mapping-table {
    table-layout: fixed;
    width: 100%;
}

.import-mapping-table th:nth-child(1),
.import-mapping-table td:nth-child(1) {
    width: 25%; /* Required Field */
}

.import-mapping-table th:nth-child(2),
.import-mapping-table td:nth-child(2) {
    width: 35%; /* Mapped to Column */
}

.import-mapping-table th:nth-child(3),
.import-mapping-table td:nth-child(3) {
    width: 40%; /* Sample Data */
}

.sample-data {
    font-size: 0.875rem;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sample-data:hover {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
}

/* ========================================
   MOBILE APP-LIKE EXPERIENCE
   ========================================
   Applied only to non-admin pages on mobile devices
   Desktop experience remains unchanged
   ======================================== */

/* Desktop: Hide mobile components, keep current design */
@media (min-width: 768px) {
    .mobile-bottom-nav {
        display: none !important;
    }

    /* Hide mobile role switcher bar on desktop */
    .mobile-role-switcher-bar {
        display: none !important;
    }

    /* Hide mobile role switcher modal on desktop */
    .modal[data-mobile-modal="true"] {
        display: none !important;
    }

    /* Ensure desktop navigation works normally */
    .navbar-nav {
        display: flex !important;
    }
}

/* Mobile: App-like experience for non-admin pages */
@media (max-width: 767px) {
    /* Admin pages: Keep desktop-style navigation with hamburger */
    .admin-page .mobile-bottom-nav {
        display: none !important;
    }

    .admin-page .navbar-nav {
        display: block !important;
    }

    .admin-page .navbar-toggler {
        display: block !important; /* Show hamburger for admin on mobile */
    }

    /* User pages: Show mobile app-like interface, hide hamburger */
    .user-page[data-mobile-app="true"] .navbar-nav {
        display: none !important;
    }

    .user-page[data-mobile-app="true"] .mobile-bottom-nav {
        display: flex !important;
    }

    .user-page[data-mobile-app="true"] .navbar-toggler {
        display: none !important; /* Hide hamburger on mobile app pages */
    }

    /* Mobile Bottom Navigation Styling */
    .mobile-bottom-nav {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: #ffffff;
        border-top: 1px solid #e0e0e0;
        display: flex;
        justify-content: space-evenly;
        padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
        z-index: 1000;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        /* iOS style backdrop blur effect */
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        text-decoration: none;
        color: #6c757d;
        padding: 4px 4px;
        border-radius: 12px;
        transition: all 0.2s ease;
        min-width: 45px;
        flex: 1;
        max-width: 70px;
        /* Touch-friendly tap target */
        min-height: 44px;
        justify-content: center;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item:focus {
        color: var(--primary-color);
        text-decoration: none;
        transform: translateY(-1px);
    }

    .mobile-nav-item.active {
        color: var(--primary-color);
        background: rgba(30, 58, 95, 0.1);
    }

    .mobile-nav-item i {
        font-size: 16px;
        margin-bottom: 2px;
        transition: transform 0.2s ease;
    }

    .mobile-nav-item.active i {
        transform: scale(1.1);
    }

    .mobile-nav-item span {
        font-size: 8px;
        font-weight: 500;
        text-align: center;
        line-height: 1.2;
    }

    /* Compact Mobile Header */
    .user-page[data-mobile-app="true"] .navbar {
        padding: 0.5rem 0;
        margin-bottom: 1rem;
    }

    .user-page[data-mobile-app="true"] .navbar-brand {
        font-size: 1.1rem;
    }

    .user-page[data-mobile-app="true"] .navbar-brand img {
        height: 28px;
    }

    /* Add bottom padding to main content to account for bottom nav */
    .user-page[data-mobile-app="true"] main {
        padding-bottom: 80px;
    }

    .user-page[data-mobile-app="true"] .container,
    .user-page[data-mobile-app="true"] .container-fluid {
        padding-bottom: 20px;
    }

    /* Card-based Mobile Layout */
    .user-page[data-mobile-app="true"] .card {
        border: none;
        border-radius: 16px;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
        margin-bottom: 16px;
    }

    .user-page[data-mobile-app="true"] .card-header {
        border-radius: 16px 16px 0 0;
        background: #f8f9fa;
        border: none;
        padding: 16px 20px;
    }

    .user-page[data-mobile-app="true"] .card-body {
        padding: 20px;
    }

    /* Larger Touch Targets */
    .user-page[data-mobile-app="true"] .btn {
        min-height: 44px;
        padding: 12px 20px;
        border-radius: 12px;
        font-weight: 500;
    }

    .user-page[data-mobile-app="true"] .list-group-item {
        padding: 16px 20px;
        border-radius: 12px !important;
        margin-bottom: 8px;
        border: none;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    }

    .user-page[data-mobile-app="true"] .form-control,
    .user-page[data-mobile-app="true"] .form-select {
        min-height: 44px;
        border-radius: 12px;
        border: 1px solid #e0e0e0;
        padding: 12px 16px;
    }

    /* Mobile-Optimized Tables */
    .user-page[data-mobile-app="true"] .table-responsive {
        border-radius: 16px;
        overflow: hidden;
        box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    }

    /* Alert Styling */
    .user-page[data-mobile-app="true"] .alert {
        border-radius: 16px;
        border: none;
        padding: 16px 20px;
        margin-bottom: 16px;
    }

    /* Dashboard Quick Links Mobile Optimization */
    .user-page[data-mobile-app="true"] .list-group-item-action:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    }

    /* Smooth Mobile Transitions */
    .user-page[data-mobile-app="true"] * {
        transition: transform 0.2s ease, box-shadow 0.2s ease;
    }

    /* Mobile Safe Areas (iPhone notch support) */
    .mobile-bottom-nav {
        padding-bottom: calc(8px + env(safe-area-inset-bottom));
    }

    .user-page[data-mobile-app="true"] {
        padding-top: env(safe-area-inset-top);
    }

    /* Mobile Role Switcher Bar - ONLY visible on mobile */
    .mobile-role-switcher-bar {
        background: #f8f9fa;
        border-bottom: 1px solid #e0e0e0;
        padding: 12px 0;
        display: none; /* Hidden by default */
    }

    /* Only show on mobile for non-admin user pages */
    .user-page[data-mobile-app="true"] .mobile-role-switcher-bar {
        display: block;
    }

    /* Always hidden on admin pages */
    .admin-page .mobile-role-switcher-bar {
        display: none !important;
    }

    .current-role-info {
        display: flex;
        align-items: center;
        color: var(--primary-color);
        font-weight: 600;
        font-size: 14px;
    }

    .current-role-info .role-name {
        margin-left: 4px;
    }

    .btn-role-switch {
        background: var(--primary-color);
        color: white;
        border: none;
        border-radius: 20px;
        padding: 8px 16px;
        font-size: 12px;
        font-weight: 500;
        display: flex;
        align-items: center;
        gap: 6px;
        transition: all 0.2s ease;
        box-shadow: 0 2px 6px rgba(30, 58, 95, 0.3);
    }

    .btn-role-switch:hover,
    .btn-role-switch:focus {
        background: var(--accent-color);
        color: white;
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(30, 58, 95, 0.4);
    }

    .btn-role-switch i {
        font-size: 11px;
    }

    /* Mobile Role Switcher Modal - Bottom Sheet Style */
    .modal-bottom-sheet {
        margin: 0;
        margin-top: auto;
        max-width: 100%;
        width: 100%;
        height: auto;
        max-height: 70vh;
    }

    .modal-bottom-sheet .modal-content {
        border-radius: 24px 24px 0 0;
        border: none;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
    }

    .modal-bottom-sheet .modal-header,
    #mobileRoleSwitcherModal .modal-header {
        border-bottom: 1px solid #163a5f !important;
        padding: 20px 24px 16px !important;
        border-radius: 24px 24px 0 0 !important;
        background: #1e3a5f !important;
        background-color: #1e3a5f !important;
        color: white !important;
    }

    .modal-bottom-sheet .modal-title,
    #mobileRoleSwitcherModal .modal-title {
        font-weight: 600 !important;
        font-size: 18px !important;
        color: white !important;
    }

    .modal-bottom-sheet .modal-title i,
    #mobileRoleSwitcherModal .modal-title i {
        color: white !important;
    }

    .modal-bottom-sheet .btn-close,
    #mobileRoleSwitcherModal .btn-close {
        background: none !important;
        border: none !important;
        font-size: 20px !important;
        opacity: 0.9 !important;
        color: white !important;
        filter: brightness(0) invert(1) !important;
    }

    /* Override any dropdown menu styles that might affect the modal */
    #mobileRoleSwitcherModal {
        z-index: 1055 !important; /* Ensure proper layering above other elements */
    }

    #mobileRoleSwitcherModal .modal-dialog {
        background: transparent !important;
        border: none !important;
    }

    #mobileRoleSwitcherModal .modal-content {
        background: white !important;
        border: none !important;
        box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15) !important;
    }

    .role-options {
        display: flex;
        flex-direction: column;
        padding: 8px 0;
    }

    .role-option {
        display: flex;
        align-items: center;
        width: 100%;
        padding: 20px 24px;
        border: none;
        background: white;
        text-align: left;
        transition: all 0.2s ease;
        position: relative;
    }

    .role-option:hover,
    .role-option:focus {
        background: #f8f9fa;
        outline: none;
    }

    .role-option.active {
        background: rgba(30, 58, 95, 0.05);
    }

    .role-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        background: var(--primary-color);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-right: 16px;
        flex-shrink: 0;
    }

    .role-icon i {
        font-size: 20px;
        color: white;
    }

    .role-option.active .role-icon {
        background: var(--accent-color);
        transform: scale(1.05);
    }

    .role-details {
        flex: 1;
        min-width: 0;
    }

    .role-details .role-name {
        font-size: 16px;
        font-weight: 600;
        color: var(--text-color);
        margin-bottom: 4px;
        line-height: 1.2;
    }

    .role-details .role-description {
        font-size: 13px;
        color: var(--text-light);
        line-height: 1.3;
    }

    .role-check {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        background: var(--success-color);
        display: flex;
        align-items: center;
        justify-content: center;
        margin-left: 12px;
        flex-shrink: 0;
    }

    .role-check i {
        font-size: 12px;
        color: white;
    }

    /* Animation for role switching */
    .role-option:active {
        transform: scale(0.98);
        background: rgba(30, 58, 95, 0.1);
    }

    /* Bottom sheet slide up animation */
    .modal.fade .modal-bottom-sheet {
        transform: translateY(100%);
        transition: transform 0.3s ease-out;
    }

    .modal.show .modal-bottom-sheet {
        transform: translateY(0);
    }

    /* Hide desktop role switcher on mobile */
    .user-page[data-mobile-app="true"] .nav-item.dropdown:has([id="userDropdown"]) {
        display: none !important;
    }

    /* Hide redundant dashboard cards on mobile app pages */
    /* Cards that have equivalent bottom tab functionality */

    /* Hide "Appointments" card - has bottom tab equivalent */
    .user-page[data-mobile-app="true"] .card:has(a[href="/Appointments"]) {
        display: none !important;
    }


    /* Hide "Manage Referees" card - has bottom tab equivalent for Parent/Manager */
    .user-page[data-mobile-app="true"] .card:has(a[href="/Referees/Manage"]) {
        display: none !important;
    }

    /* Hide any "Availability" card if it exists - has bottom tab equivalent for Referee */
    .user-page[data-mobile-app="true"] .card:has(a[href*="/Availability"]) {
        display: none !important;
    }

    /* Hide "Competition Ladder" card - has bottom tab equivalent */
    .user-page[data-mobile-app="true"] .card:has(a[href="/Ladder"]) {
        display: none !important;
    }

    /* Keep unique cards visible: Quick Links, etc. */
    /* No additional rules needed - they'll show by default */
}

/* Google Login Button Styling */
.btn-google {
    background-color: #4285f4;
    border-color: #4285f4;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.btn-google:hover {
    background-color: #357ae8;
    border-color: #357ae8;
    color: white;
}

.btn-google:focus {
    background-color: #357ae8;
    border-color: #357ae8;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(66, 133, 244, 0.25);
}

.btn-google:active {
    background-color: #2d5aa0;
    border-color: #2d5aa0;
    color: white;
}

.btn-google i {
    font-size: 1.1em;
}

/* Facebook Login Button Styling */
.btn-facebook {
    background-color: #1877f2;
    border-color: #1877f2;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.btn-facebook:hover {
    background-color: #166fe5;
    border-color: #166fe5;
    color: white;
}

.btn-facebook:focus {
    background-color: #166fe5;
    border-color: #166fe5;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(24, 119, 242, 0.25);
}

.btn-facebook:active {
    background-color: #1464d0;
    border-color: #1464d0;
    color: white;
}

.btn-facebook i {
    font-size: 1.1em;
}

/* Apple Login Button Styling */
.btn-apple {
    background-color: #000000;
    border-color: #000000;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.btn-apple:hover {
    background-color: #333333;
    border-color: #333333;
    color: white;
}

.btn-apple:focus {
    background-color: #333333;
    border-color: #333333;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(0, 0, 0, 0.25);
}

.btn-apple:active {
    background-color: #1a1a1a;
    border-color: #1a1a1a;
    color: white;
}

.btn-apple i {
    font-size: 1.1em;
}

/* Microsoft Login Button Styling */
.btn-microsoft {
    background-color: #0078d4;
    border-color: #0078d4;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-weight: 500;
    transition: background-color 0.2s ease;
}

.btn-microsoft:hover {
    background-color: #106ebe;
    border-color: #106ebe;
    color: white;
}

.btn-microsoft:focus {
    background-color: #106ebe;
    border-color: #106ebe;
    color: white;
    box-shadow: 0 0 0 0.2rem rgba(0, 120, 212, 0.25);
}

.btn-microsoft:active {
    background-color: #005a9e;
    border-color: #005a9e;
    color: white;
}

.btn-microsoft i {
    font-size: 1.1em;
}

/* PWA Styles */

/* Install Banner */
.pwa-install-banner, .pwa-update-banner {
    position: fixed;
    bottom: -100px;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    transition: bottom 0.3s ease-in-out;
}

.pwa-install-banner.show, .pwa-update-banner.show {
    bottom: 0;
}

.pwa-banner-content {
    display: flex;
    align-items: center;
    max-width: 400px;
    margin: 0 auto;
    gap: 12px;
}

.pwa-banner-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.pwa-banner-text {
    flex-grow: 1;
}

.pwa-banner-text strong {
    display: block;
    font-size: 1.1rem;
    margin-bottom: 2px;
}

.pwa-banner-text p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.pwa-banner-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

/* Offline Indicator */
.offline-indicator {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff6b6b;
    color: white;
    padding: 8px 16px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    z-index: 9998;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
}

.offline-indicator.show {
    transform: translateX(0);
}

/* Toast Notifications */
.pwa-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    background: #333;
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 9997;
    transition: transform 0.3s ease-in-out;
    max-width: 90%;
    text-align: center;
}

.pwa-toast.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-toast-success {
    background: #51cf66;
}

.pwa-toast-warning {
    background: #ffd43b;
    color: #333;
}

.pwa-toast-error {
    background: #ff6b6b;
}

/* PWA Mobile Optimizations */
@media (max-width: 767px) {
    .pwa-banner-content {
        flex-wrap: wrap;
        text-align: center;
    }

    .pwa-banner-actions {
        width: 100%;
        justify-content: center;
        margin-top: 8px;
    }

    .offline-indicator {
        right: 10px;
        top: 10px;
        font-size: 0.8rem;
        padding: 6px 12px;
    }

    .pwa-toast {
        max-width: 95%;
        font-size: 0.85rem;
        padding: 10px 20px;
    }
}

/* PWA Update Banner */
.pwa-update-banner {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    transition: transform 0.4s ease-out;
    max-width: 400px;
    width: 90%;
}

.pwa-update-banner.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-update-banner .pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-update-banner .pwa-banner-icon {
    font-size: 1.5rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* PWA Update Success Banner */
.pwa-update-success {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    background: linear-gradient(135deg, #51cf66 0%, #40c057 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(81, 207, 102, 0.4);
    z-index: 10002;
    transition: transform 0.4s ease-out;
    max-width: 400px;
    width: 90%;
}

.pwa-update-success.show {
    transform: translateX(-50%) translateY(0);
}

.pwa-update-success .pwa-banner-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.pwa-update-success .pwa-banner-icon {
    font-size: 1.5rem;
    animation: checkmark-bounce 0.6s ease-out;
}

@keyframes checkmark-bounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

/* Enhanced Update Banner Styling */
.pwa-update-banner .btn-success {
    background: #51cf66;
    border-color: #51cf66;
    font-weight: 500;
}

.pwa-update-banner .btn-success:hover {
    background: #40c057;
    border-color: #40c057;
    transform: translateY(-1px);
}

.pwa-update-banner .btn-outline-secondary {
    border-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}

.pwa-update-banner .btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    color: white;
}

/* PWA Standalone Mode Styles */
@media all and (display-mode: standalone) {
    /* Hide elements that don't make sense in standalone mode */
    .browser-only {
        display: none !important;
    }

    /* Adjust layout for standalone mode */
    body {
        user-select: none; /* Prevent text selection like native apps */
        -webkit-touch-callout: none; /* Disable callout on iOS */
    }

    /* Status bar spacing for PWA */
    .user-page[data-mobile-app="true"] {
        padding-top: env(safe-area-inset-top, 0);
        padding-bottom: env(safe-area-inset-bottom, 0);
    }

    /* Better button styles for PWA */
    .btn {
        border-radius: 12px;
        font-weight: 500;
    }
}

/* Appointments Page Filter Fixes */
@media (max-width: 767px) {
    /* Ensure filter controls are always visible on mobile */
    .user-page[data-mobile-app="true"] .card:has(.row.g-3),
    .user-page .card:has(form[method="get"]) {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        position: relative !important;
        z-index: 1 !important;
        background: #ffffff !important;
        border: 1px solid #dee2e6 !important;
        margin-bottom: 1rem !important;
    }

    /* Ensure form and its children are visible */
    .user-page[data-mobile-app="true"] form[method="get"],
    .user-page[data-mobile-app="true"] form[method="get"] .row,
    .user-page[data-mobile-app="true"] form[method="get"] .col-12,
    .user-page[data-mobile-app="true"] form[method="get"] .col-6,
    .user-page[data-mobile-app="true"] form[method="get"] .col-md-3,
    .user-page[data-mobile-app="true"] form[method="get"] .col-md-6,
    .user-page[data-mobile-app="true"] form[method="get"] .col-lg-2 {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }

    /* Special handling for Bootstrap flex columns */
    .user-page[data-mobile-app="true"] form[method="get"] .row.g-3 {
        display: flex !important;
        flex-wrap: wrap !important;
    }

    /* Ensure button groups are visible */
    .user-page[data-mobile-app="true"] .btn-group,
    .user-page[data-mobile-app="true"] .btn-group .btn,
    .user-page[data-mobile-app="true"] .form-select {
        display: inline-block !important;
        visibility: visible !important;
    }

    .user-page[data-mobile-app="true"] .btn-group.d-flex {
        display: flex !important;
    }

    /* Hide native select dropdowns on mobile when custom dropdowns exist */
    @media (max-width: 767px) {
        /* Hide club and qualification dropdowns because they have custom mobile replacements */
        .user-page[data-mobile-app="true"] select[data-club-dropdown="true"],
        .user-page[data-mobile-app="true"] select[data-qualification-dropdown="true"] {
            display: none !important;
            visibility: hidden !important;
            position: absolute !important;
            left: -9999px !important;
            opacity: 0 !important;
        }

        /* Keep season dropdown visible - it doesn't have a custom mobile replacement */
        .user-page[data-mobile-app="true"] select[data-season-dropdown="true"],
        .user-page[data-mobile-app="true"] #seasonSelect {
            display: block !important;
            visibility: visible !important;
            position: relative !important;
            left: auto !important;
            opacity: 1 !important;
        }

        /* More specific targeting for Registration page - hide form selects except season */
        body.user-page[data-mobile-app="true"] select.form-select[required]:not(#seasonSelect):not([data-season-dropdown]):not(#mobileSeasonId):not(#mobileCompetitionName):not(#mobilePool):not(#mobileRound) {
            display: none !important;
            visibility: hidden !important;
        }

        /* Target all form selects on mobile registration pages - hide except season, ladder dropdowns, appointment filters, draw filters, and managed referee dropdown */
        body.user-page[data-mobile-app="true"] .container-fluid select.form-select:not(#seasonSelect):not([data-season-dropdown]):not(#mobileSeasonId):not(#mobileCompetitionName):not(#mobilePool):not(#mobileRound):not(#selectedSeasonId):not(#selectedCompetitionName):not(#selectedPool):not(#selectedRound):not(#FilterStatus):not(#FilterSeason):not(#FilterDate):not(#FilterReferee):not(#SelectedSeasonId):not(#SelectedCompetitionName):not(#SelectedPool):not(#SelectedRound):not(#SelectedTeamId):not([name="Input.ExistingRefereeId"]) {
            display: none !important;
            visibility: hidden !important;
        }
    }


/* Fix dropdown menu backgrounds - all dropdowns should have white background */
.dropdown-menu {
    background-color: #ffffff !important;
    border: 1px solid rgba(0,0,0,.15) !important;
}

.dropdown-item {
    background-color: transparent !important;
    color: #212529 !important;
}

.dropdown-item:hover,
.dropdown-item:focus {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

/* Global Modal Backdrop Fix - Ensures modals work properly across all pages */
.modal-backdrop {
    /* Backdrop should capture clicks for dismissal but not block modal */
    pointer-events: auto !important;
    z-index: 1050 !important;
}

.modal-backdrop.show {
    /* Ensure visible backdrop allows interaction */
    pointer-events: auto !important;
    opacity: 0.5;
}

/* Ensure modals appear above backdrop and header (header is z-index 1030) */
.modal {
    z-index: 1060 !important;
    /* Prevent body scroll blocking modal interaction */
    pointer-events: auto !important;
}

.modal-dialog {
    /* Ensure modal content is interactive and above everything */
    pointer-events: auto !important;
    z-index: 1061 !important;
}

.modal-content {
    /* Ensure all modal content is fully interactive */
    pointer-events: auto !important;
    position: relative;
    z-index: 1062 !important;
}

/* Fix for mobile modal issues - ensure touch events work */
@media (max-width: 767px) {
    .modal.show {
        /* Force hardware acceleration for smoother mobile performance */
        transform: translate3d(0, 0, 0);
        -webkit-transform: translate3d(0, 0, 0);
    }

    .modal-dialog {
        /* Ensure modal is touchable on mobile */
        touch-action: auto !important;
    }

    /* Prevent body scroll issues on mobile when modal is open */
    body.modal-open {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
    }
}
