/* GamScale Base Styles */

:root {
    --gamscale-primary: #0066cc;
    --gamscale-secondary: #004499;
    --gamscale-accent: #00aaff;
    --gamscale-dark: #1a1a1a;
    --gamscale-light: #f8f9fa;
}

* {
    font-family: 'Inter', sans-serif;
}

/* Consistent font styling across all pages */
body {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

p, .lead {
    font-family: 'Inter', sans-serif;
}

body {
    padding-top: 0;
    background-color: var(--gamscale-light);
}

/* Body padding for fixed header - exact header height, no extra spacing */
body {
    padding-top: 75px !important; /* Header height: navbar padding (0.5rem top + 0.5rem bottom = 16px) + logo/text (~59px) = ~75px */
}

/* Admin portal specific padding - exact header height, no extra spacing */
body.admin-portal {
    padding-top: 75px !important; /* Header height: navbar padding (0.5rem top + 0.5rem bottom = 16px) + logo/text (~59px) = ~75px */
}

/* Public Header - Fixed Position */
.public-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.public-header .navbar {
    padding: 0.5rem 0;
    overflow: visible;
    min-height: auto;
    position: relative;
}

.public-header .container-fluid {
    padding-left: var(--bs-gutter-x, 0.75rem);
    padding-right: var(--bs-gutter-x, 0.75rem);
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    width: 100%;
    overflow: visible;
    position: relative;
}

.public-header .company-logo {
    height: 45px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.public-header a[href] {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.public-header a[href]:hover {
    opacity: 0.8;
}

.public-header .portal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    line-height: 1.2;
}

.public-header .company-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    line-height: 1;
}

/* Public Navigation - On Right Side */
/* Only show navbar-nav on desktop - let Bootstrap handle mobile collapse */
@media (min-width: 992px) {
    .public-header .navbar-nav {
        margin: 0;
        margin-right: auto;
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
        gap: 0.5rem;
    }
    
    .public-header .navbar-nav .nav-item {
        margin-right: 0.25rem;
    }
}

.public-header .nav-link {
    color: white !important;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    font-family: 'Inter', sans-serif;
}

.public-header .nav-link i {
    color: white !important;
    font-weight: 600;
}

.public-header .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.15);
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.public-header .nav-link:hover i {
    color: white !important;
}

.public-header .nav-link.active {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.2);
    border-bottom-color: white;
    font-weight: 700;
}

.public-header .nav-link.active i {
    color: white !important;
    font-weight: 700;
}

/* Public Header Dropdown Styles - Desktop: Show on hover, absolutely positioned */
@media (min-width: 992px) {
    /* Ensure dropdown parent is positioned relatively */
    .public-header .nav-item.dropdown {
        position: relative;
    }
    
    /* Show dropdown on hover */
    .public-header .nav-item.dropdown:hover .dropdown-menu {
        display: block !important;
        opacity: 1;
        visibility: visible;
    }
    
    /* Dropdown menu - absolutely positioned, does NOT affect header height */
    .public-header .dropdown-menu {
        position: absolute !important;
        top: 100% !important;
        left: 0 !important;
        right: auto !important;
        z-index: 1000 !important;
        display: none;
        min-width: 100%;
        width: max-content;
        max-width: 90vw;
        padding: 0.5rem 0 !important;
        margin: 0 !important;
        margin-top: 0 !important;
        background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%) !important;
        border: none !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        /* Prevent affecting layout */
        float: none !important;
        clear: none !important;
    }
    
    .public-header .dropdown-item {
        padding: 0.75rem 1.5rem;
        color: white !important;
        font-weight: 500;
        transition: all 0.2s ease;
        white-space: nowrap;
    }
    
    .public-header .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.15) !important;
        color: white !important;
    }
    
    .public-header .dropdown-item i {
        color: white !important;
        width: 20px;
    }
    
    /* Prevent navbar from expanding */
    .public-header .navbar {
        overflow: visible !important;
    }
    
    .public-header .navbar-nav {
        overflow: visible !important;
    }
    
    .public-header .nav-item {
        overflow: visible !important;
    }
}

/* Mobile/Tablet: Full-width dropdowns in hamburger menu */
@media (max-width: 991.98px) {
    .public-header .dropdown-menu {
        width: 100%;
        position: static !important;
        margin-top: 0.5rem;
        margin-left: 1rem;
        margin-right: auto !important;
        left: auto !important;
        right: auto !important;
        transform: none !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 6px;
    }
    
    .public-header .dropdown-item {
        padding: 0.75rem 1rem;
        color: white !important;
    }
    
    .public-header .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.2) !important;
    }
    
    .public-header .dropdown-item i {
        color: white !important;
        width: 20px;
    }
}

/* Mobile Menu Toggle Button */
.public-header .navbar-toggler,
.admin-header .navbar-toggler {
    border: 2px solid rgba(255, 255, 255, 0.5);
    padding: 0.25rem 0.5rem;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Ensure hamburger menu is visible on mobile/tablet */
@media (max-width: 991.98px) {
    .public-header .navbar-toggler,
    .admin-header .navbar-toggler {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
    }
}

/* Hide navbar-toggler on desktop (Bootstrap default) */
@media (min-width: 992px) {
    .public-header .navbar-toggler,
    .admin-header .navbar-toggler {
        display: none;
    }
}

.public-header .navbar-toggler:focus,
.admin-header .navbar-toggler:focus {
    box-shadow: 0 0 0 0.25rem rgba(255, 255, 255, 0.25);
}

.public-header .navbar-toggler-icon,
.admin-header .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, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Mobile Navigation Styles */
@media (max-width: 991.98px) {
    /* Staff Portal button alignment */
    .public-header .staff-portal-btn {
        margin-right: 0.5rem;
    }
    
    /* Position the navbar-collapse absolutely when shown - opens below hamburger, aligned to left */
    .public-header .navbar-collapse.show,
    .public-header .navbar-collapse.collapsing {
        position: absolute !important;
        top: 100% !important;
        right: var(--bs-gutter-x, 0.75rem) !important;
        left: auto !important;
        width: auto !important;
        min-width: 250px !important;
        max-width: calc(100vw - 2 * var(--bs-gutter-x, 0.75rem)) !important;
        z-index: 1040 !important;
        margin-top: 0.5rem !important;
        background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%) !important;
        padding: 1rem !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        transform-origin: top right !important;
    }
    
    /* Position the admin header navbar-collapse absolutely when shown - same as public portal */
    .admin-header .navbar-collapse.show,
    .admin-header .navbar-collapse.collapsing {
        position: absolute !important;
        top: 100% !important;
        right: var(--bs-gutter-x, 0.75rem) !important;
        left: auto !important;
        width: auto !important;
        min-width: 250px !important;
        max-width: calc(100vw - 2 * var(--bs-gutter-x, 0.75rem)) !important;
        z-index: 1040 !important;
        margin-top: 0.5rem !important;
        background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%) !important;
        padding: 1rem !important;
        border-radius: 8px !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
        transform-origin: top right !important;
    }
    
    .public-header .navbar-collapse.show .navbar-nav,
    .admin-header .navbar-collapse.show .navbar-nav {
        flex-direction: column !important;
        width: 100%;
        display: flex !important;
    }
    
    /* Ensure navbar-nav in public header collapse aligns properly */
    .public-header .navbar-collapse .navbar-nav {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%;
    }
    
    /* Ensure navbar-nav in admin header collapse aligns properly */
    .admin-header .navbar-collapse .navbar-nav {
        margin-left: 0 !important;
        margin-right: 0 !important;
        width: 100%;
    }
    
    .public-header .nav-item,
    .admin-header .nav-item {
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .public-header .nav-link,
    .admin-header .nav-link {
        width: 100%;
        padding: 0.75rem 1rem !important;
        text-align: left;
    }
    
    /* Mobile Dropdown Styles */
    .public-header .dropdown-menu,
    .admin-header .dropdown-menu {
        position: static !important;
        float: none;
        width: 100%;
        margin-top: 0.5rem;
        margin-left: 1rem;
        background-color: rgba(255, 255, 255, 0.1) !important;
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 6px;
    }
    
    .public-header .dropdown-item,
    .admin-header .dropdown-item {
        padding: 0.75rem 1rem;
        color: white !important;
    }
    
    .public-header .dropdown-item:hover,
    .admin-header .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.2) !important;
    }
    
    .public-header .dropdown-toggle::after,
    .admin-header .dropdown-toggle::after {
        margin-left: auto;
    }
    
    .public-header .dropdown-item.active,
    .admin-header .dropdown-item.active {
        background-color: rgba(255, 255, 255, 0.2) !important;
        color: white !important;
    }
    
    /* User Menu in Mobile Hamburger Menu */
    .admin-header .navbar-collapse .user-menu {
        width: 100%;
    }
    
    .admin-header .navbar-collapse .user-menu .dropdown {
        width: 100%;
    }
    
    .admin-header .navbar-collapse .user-menu .user-menu-btn {
        width: 100%;
        justify-content: flex-start;
        padding: 0.75rem 1rem;
    }
    
    .admin-header .navbar-collapse .user-menu .user-menu-dropdown {
        width: 100%;
        position: static !important;
        margin-top: 0.5rem;
    }
}

/* Staff Portal Button - Distinct and Prominent */
.staff-portal-btn {
    background: linear-gradient(135deg, #2d55db 0%, #6823c8 100%) !important;
    color: white !important;
    font-weight: 600 !important;
    font-size: 0.85rem !important;
    border-radius: 8px !important;
    padding: 0.45rem 1rem !important;
    margin-left: 1.5rem !important;
    transition: all 0.3s ease !important;
    box-shadow: 0 2px 8px rgba(45, 85, 219, 0.3) !important;
    white-space: nowrap;
    display: flex;
    align-items: center;
}

.staff-portal-btn:hover {
    background: linear-gradient(135deg, #1e3fa8 0%, #4d1a9a 100%) !important;
    color: white !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(45, 85, 219, 0.5) !important;
}

.staff-portal-btn i {
    color: white !important;
    font-weight: 600;
}

@media (max-width: 991.98px) {
    .staff-portal-btn {
        margin-left: 0 !important;
        width: auto;
        min-width: auto;
        padding: 0.35rem 0.75rem !important;
        font-size: 0.75rem !important;
        white-space: nowrap;
    }
}

/* Admin Header - Fixed Position */
.admin-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: visible;
}

.admin-header .navbar {
    padding: 0.5rem 0;
    position: relative;
}

.admin-header .container-fluid {
    overflow: visible;
    display: flex;
    align-items: center;
    position: relative;
}

.admin-header .company-logo {
    height: 45px;
    width: auto;
    max-width: 150px;
    object-fit: contain;
}

.admin-header a[href] {
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.admin-header a[href]:hover {
    opacity: 0.8;
}

.admin-header .portal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: white;
    line-height: 1.2;
}

.admin-header .company-subtitle {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.8);
    font-weight: 400;
    line-height: 1;
}

/* Admin Navigation - Proper spacing from logo */
.admin-header .navbar-nav {
    margin: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.admin-header .nav-link {
    color: white !important;
    font-weight: 600;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    transition: all 0.3s ease;
    white-space: nowrap;
    border-bottom: 3px solid transparent;
    font-family: 'Inter', sans-serif;
}

.admin-header .nav-link i {
    color: white !important;
    font-weight: 600;
}

.admin-header .nav-link:hover {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.15);
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.admin-header .nav-link:hover i {
    color: white !important;
}

.admin-header .nav-link.active {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.2);
    border-bottom-color: white;
    font-weight: 700;
}

.admin-header .nav-link.active i {
    color: white !important;
    font-weight: 700;
}

/* Admin Header Dropdown Styling */
.admin-header .dropdown .nav-link {
    cursor: pointer;
}

/* Position dropdown container relative for absolute positioning */
.admin-header .nav-item.dropdown {
    position: relative;
}

/* Show dropdown on hover (desktop only) */
@media (min-width: 992px) {
    .admin-header .nav-item.dropdown:hover .dropdown-menu,
    .admin-header .nav-item.dropdown .dropdown-menu.show {
        display: block !important;
    }
    
    /* Force ALL admin header dropdowns to open to the left (right-aligned) - override everything */
    .admin-header .nav-item.dropdown .dropdown-menu,
    .admin-header .nav-item.dropdown .dropdown-menu.dropdown-menu-end,
    .admin-header .nav-item.dropdown:hover .dropdown-menu,
    .admin-header .nav-item.dropdown:hover .dropdown-menu.dropdown-menu-end,
    .admin-header .nav-item.dropdown .dropdown-menu.show,
    .admin-header .nav-item.dropdown .dropdown-menu.dropdown-menu-end.show,
    .admin-header .dropdown-menu,
    .admin-header .dropdown-menu.dropdown-menu-end {
        position: absolute !important;
        top: 100% !important;
        right: 0 !important;
        left: auto !important;
        inset-inline-end: 0 !important;
        inset-inline-start: auto !important;
        z-index: 9999 !important;
        margin-top: 0 !important;
        margin-right: 0 !important;
        margin-left: auto !important;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        min-width: max-content !important;
        width: max-content !important;
        max-width: 90vw;
        white-space: nowrap;
        transform: none !important;
    }
    
    .admin-header .nav-item.dropdown:hover > .nav-link {
        color: white !important;
        background-color: rgba(255, 255, 255, 0.15);
        border-bottom-color: rgba(255, 255, 255, 0.5);
    }
}

.admin-header .dropdown-menu {
    background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%);
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 6px;
    padding: 0.5rem 0;
}

/* Force admin header dropdowns to always open to the left (right-aligned) - highest priority */
@media (min-width: 992px) {
    .admin-header .dropdown-menu.dropdown-menu-end,
    .admin-header .nav-item.dropdown .dropdown-menu.dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
        inset-inline-end: 0 !important;
        inset-inline-start: auto !important;
    }
}

/* Force all admin header dropdowns to open to the left (right-aligned) - override Bootstrap defaults */
@media (min-width: 992px) {
    .admin-header .dropdown-menu.dropdown-menu-end,
    .admin-header .nav-item.dropdown .dropdown-menu.dropdown-menu-end {
        right: 0 !important;
        left: auto !important;
        inset-inline-end: 0 !important;
        inset-inline-start: auto !important;
        transform: none !important;
    }
}

.admin-header .dropdown-item {
    color: white;
    padding: 0.5rem 1.5rem;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.admin-header .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.15);
    color: white;
}

.admin-header .dropdown-item.active {
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
}

.admin-header .dropdown-item i {
    color: inherit;
}

/* User Menu - Dropdown Style - Same as admin header dropdowns */
.user-menu {
    position: relative;
}

.user-menu .dropdown {
    position: relative;
}

/* Show user menu dropdown on hover (desktop) and click (mobile) */
@media (min-width: 992px) {
    .admin-header .user-menu .dropdown:hover .dropdown-menu,
    .admin-header .user-menu .dropdown .dropdown-menu.show {
        display: block !important;
    }
}

.user-menu .user-menu-btn {
    color: white !important;
    text-decoration: none;
    border: none;
    background: none;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.user-menu .user-menu-btn:hover,
.user-menu .user-menu-btn:focus {
    color: white !important;
    background-color: rgba(255, 255, 255, 0.15);
    border-bottom-color: rgba(255, 255, 255, 0.5);
}

.user-menu .user-menu-btn::after {
    margin-left: 0.5rem;
}

.user-menu .user-name {
    color: white !important;
    font-weight: 600;
    font-size: 0.9rem;
    white-space: normal;
    word-wrap: break-word;
    max-width: 150px;
    line-height: 1.2;
}

.user-menu .user-menu-btn i {
    color: white !important;
    font-size: 1.5rem;
}

/* User menu dropdown - Same background and behavior as admin header dropdowns */
.admin-header .user-menu .dropdown-menu {
    background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%) !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    border-radius: 6px !important;
    padding: 0.25rem 0 !important;
    min-width: 200px;
    width: max-content;
    max-width: 90vw;
    overflow: visible !important;
}

.admin-header .user-menu .dropdown-item {
    color: white !important;
    padding: 0.375rem 1rem !important;
    font-family: 'Inter', sans-serif;
    transition: all 0.2s ease;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.3;
    font-size: 0.9rem;
}

.admin-header .user-menu .dropdown-item:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
}

.admin-header .user-menu .dropdown-item i {
    color: inherit !important;
    flex-shrink: 0;
}

.admin-header .user-menu .dropdown-item-text {
    color: white !important;
    padding: 0.375rem 1rem !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    line-height: 1.3;
    width: 100%;
    box-sizing: border-box;
    overflow: visible !important;
    display: block;
    font-size: 0.9rem;
}

.admin-header .user-menu .dropdown-item-text strong {
    display: block;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    width: 100%;
    overflow: visible !important;
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.2;
}

.admin-header .user-menu .dropdown-item-text small {
    color: rgba(255, 255, 255, 0.8) !important;
    word-wrap: break-word !important;
    overflow-wrap: break-word !important;
    display: block;
    width: 100%;
    white-space: normal !important;
    overflow: visible !important;
    font-size: 0.8rem;
    line-height: 1.2;
    margin-top: 0.0625rem;
}

.admin-header .user-menu .dropdown-divider {
    margin: 0.25rem 0 !important;
    opacity: 0.3;
}

/* Desktop Navigation - Keep existing styles */

/* Navigation */
.public-navbar {
    background-color: white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.admin-navbar {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
}

.navbar-nav .nav-link {
    color: var(--gamscale-primary);
    font-weight: 500;
    padding: 0.75rem 1rem;
}

.navbar-nav .nav-link:hover {
    color: var(--gamscale-secondary);
    background-color: rgba(0, 102, 204, 0.1);
}

/* Body padding for fixed header */
body.admin-portal {
    padding-top: 120px; /* Adjust based on header height */
}

/* User Menu */
/* Old user-menu styles removed - using new styles above */

/* Footer */
.public-footer {
    background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%);
    color: white;
    margin-top: 0 !important;
    padding: 3rem 0 1.5rem 0;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.public-footer .footer-section {
    text-align: center;
}

.public-footer h5, .public-footer h6 {
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 1rem;
    font-weight: 600;
}

.public-footer p, .public-footer a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
    margin-bottom: 0.5rem;
    display: block;
}

.public-footer a:hover {
    color: white !important;
    text-decoration: underline;
}

/* Force all footer links and email addresses to be white - override everything including Bootstrap */
.public-footer a,
.public-footer a:link,
.public-footer a:visited,
.public-footer a:active,
.public-footer a:focus,
.public-footer .footer-section a,
.public-footer .footer-section a:link,
.public-footer .footer-section a:visited,
.public-footer .footer-section a:active,
.public-footer .footer-section a:focus,
.public-footer .footer-section p a,
.public-footer .footer-section p a:link,
.public-footer .footer-section p a:visited,
.public-footer .footer-section p a:active,
.public-footer .footer-section p a:focus,
.public-footer p a,
.public-footer p a:link,
.public-footer p a:visited,
.public-footer p a:active,
.public-footer p a:focus,
.public-footer a[href],
.public-footer a[href]:link,
.public-footer a[href]:visited,
.public-footer a[href]:active,
.public-footer a[href^="mailto:"],
.public-footer a[href^="mailto:"]:link,
.public-footer a[href^="mailto:"]:visited,
.public-footer a[href^="mailto:"]:active,
.public-footer .footer-section p a[href],
.public-footer .footer-section p a[href^="mailto:"] {
    color: rgba(255, 255, 255, 0.9) !important;
}

.public-footer a:hover,
.public-footer a:focus:hover,
.public-footer .footer-section a:hover,
.public-footer .footer-section a:focus:hover,
.public-footer .footer-section p a:hover,
.public-footer .footer-section p a:focus:hover,
.public-footer p a:hover,
.public-footer p a:focus:hover,
.public-footer a[href]:hover,
.public-footer a[href^="mailto:"]:hover,
.public-footer .footer-section p a[href]:hover,
.public-footer .footer-section p a[href^="mailto:"]:hover {
    color: white !important;
    text-decoration: underline !important;
}

.public-footer .text-muted {
    color: rgba(255, 255, 255, 0.9) !important;
}

.public-footer .text-muted a {
    color: rgba(255, 255, 255, 0.9) !important;
}

.public-footer .text-muted a:hover {
    color: white !important;
}

/* Ultimate override - target every possible link in footer */
footer.public-footer * a,
footer.public-footer * a:link,
footer.public-footer * a:visited,
footer.public-footer * a:active,
footer.public-footer * a:focus,
footer.public-footer * a:hover {
    color: rgba(255, 255, 255, 0.9) !important;
}

footer.public-footer * a:hover,
footer.public-footer * a:focus:hover {
    color: white !important;
    text-decoration: underline !important;
}

/* Ensure verify icon is white */
footer.public-footer a i.bi-qr-code-scan,
.public-footer a i.bi-qr-code-scan {
    color: white !important;
}

.admin-footer {
    background: linear-gradient(135deg, var(--gamscale-primary) 0%, var(--gamscale-secondary) 100%);
    color: white;
    margin-top: 0 !important;
    padding: 3rem 0 1.5rem 0;
    border-top: 2px solid rgba(255, 255, 255, 0.1);
}

.admin-footer .footer-section {
    text-align: center;
}

.admin-footer h5, .admin-footer h6 {
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 1rem;
    font-weight: 600;
}

.admin-footer p, .admin-footer a {
    color: rgba(255, 255, 255, 0.9) !important;
    text-decoration: none;
    margin-bottom: 0.5rem;
    display: block;
}

.admin-footer a:hover {
    color: white !important;
    text-decoration: underline;
}

.admin-footer .text-muted {
    color: rgba(255, 255, 255, 0.9) !important;
}

.admin-footer .text-muted a {
    color: rgba(255, 255, 255, 0.9) !important;
}

.admin-footer .text-muted a:hover {
    color: white !important;
}

.admin-footer .footer-bottom,
.public-footer .footer-bottom {
    border-top: 3px solid rgba(255,255,255,0.4);
    margin-top: 2rem;
    padding-top: 1.5rem;
    text-align: center;
    color: rgba(255,255,255,0.8);
}

.admin-footer .footer-bottom p,
.public-footer .footer-bottom p {
    color: rgba(255,255,255,0.9);
    margin-bottom: 0.5rem;
}

.admin-footer .footer-bottom p.mb-0,
.public-footer .footer-bottom p.mb-0 {
    color: rgba(255,255,255,0.8);
    margin-bottom: 0;
}

/* Force all admin footer links to be white - override Bootstrap defaults */
.admin-footer a,
.admin-footer a:link,
.admin-footer a:visited,
.admin-footer a:active,
.admin-footer p a,
.admin-footer .footer-section a,
.admin-footer .footer-section p a {
    color: rgba(255, 255, 255, 0.9) !important;
}

.admin-footer a:hover,
.admin-footer a:focus,
.admin-footer p a:hover,
.admin-footer .footer-section a:hover,
.admin-footer .footer-section p a:hover {
    color: white !important;
    text-decoration: underline !important;
}

/* Action Button Icons - Smaller size */
.btn-group-sm .btn i,
.btn-sm i {
    font-size: 0.875rem;
}

.btn-group .btn i {
    font-size: 0.875rem;
}

/* Center last row items in grids - for 5 items in 3-column layout (4th and 5th items) */
.row.g-4.justify-content-center > .col-md-6.col-lg-4:nth-child(4):nth-last-child(2),
.row.g-4.justify-content-center > .col-md-6.col-lg-4:nth-child(5):last-child {
    margin-left: auto;
    margin-right: auto;
}

/* For 6 items in 3-column layout - center last row (5th and 6th items) */
.row.g-4.justify-content-center > .col-md-6.col-lg-4:nth-child(5):nth-last-child(2),
.row.g-4.justify-content-center > .col-md-6.col-lg-4:nth-child(6):last-child {
    margin-left: auto;
    margin-right: auto;
}

/* For 5 items in 2-column layout - center last item (5th item) */
.row.g-4.justify-content-center > .col-md-6.col-lg-6:nth-child(5):last-child {
    margin-left: auto;
    margin-right: auto;
    max-width: 50%;
}

/* Ensure consistent spacing for all row items - no extra margin on last row */
.row.g-4 {
    margin-bottom: 0;
}

.row.g-4 > * {
    margin-bottom: 0;
}

/* Don't remove gap spacing - Bootstrap's g-4 handles spacing correctly */

/* Ensure all cards in rows have consistent heights and no overlaps */
.row.g-4 {
    align-items: stretch !important;
    gap: 1.5rem !important; /* Ensure gap spacing is maintained */
}

.row.g-4 > [class*="col-"] {
    display: flex !important;
    flex-direction: column;
    margin: 0 !important; /* Remove any margin that might interfere with gap */
}

.row.g-4 .card {
    display: flex !important;
    flex-direction: column;
    height: 100% !important;
    min-height: 100% !important;
    margin-bottom: 0 !important;
    overflow: hidden;
}

.row.g-4 .card.h-100 {
    height: 100% !important;
    min-height: 100% !important;
}

.row.g-4 .card .card-body {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
}

/* Ensure consistent vertical spacing in card bodies */
.row.g-4 .card .card-body > *:last-child {
    margin-bottom: 0;
}

/* Center headers in cards */
.card-header.text-center,
.card-header.bg-transparent.text-center {
    text-align: center !important;
}

/* Ensure all section headers are centered */
section .text-center h2,
section .text-center h3,
section .text-center h4,
section .text-center h5 {
    text-align: center !important;
}

/* Center last row items when using justify-content-center */
.row.g-4.justify-content-center > .col-md-3:last-child,
.row.g-4.justify-content-center > .col-md-4:last-child,
.row.g-4.justify-content-center > .col-md-6:last-child {
    margin-left: auto;
    margin-right: auto;
}

/* Force 3 cards per row on desktop screens (≥992px) and center last row items */
@media (min-width: 992px) {
    /* Ensure proper 3-column layout on desktop - Bootstrap's col-lg-4 should handle this */
    /* But we ensure the width is exactly 1/3 accounting for gaps */
    .row.g-4.justify-content-center > .col-lg-4 {
        flex: 0 0 auto;
        width: 33.33333333%;
    }
    
    /* For 6 items: last row (5th and 6th) should be centered as a pair */
    .row.g-4.justify-content-center > .col-lg-4:nth-child(5):nth-last-child(2) {
        margin-left: auto;
        margin-right: 0.5rem;
    }
    
    .row.g-4.justify-content-center > .col-lg-4:nth-child(6):last-child {
        margin-left: 0.5rem;
        margin-right: auto;
    }
    
    /* For 5 items: center the last 2 items (4th and 5th) */
    .row.g-4.justify-content-center > .col-lg-4:nth-child(4):nth-last-child(2) {
        margin-left: auto;
        margin-right: 0.5rem;
    }
    
    .row.g-4.justify-content-center > .col-lg-4:nth-child(5):last-child {
        margin-left: 0.5rem;
        margin-right: auto;
    }
    
    /* For 4 items: center the last single item */
    .row.g-4.justify-content-center > .col-lg-4:nth-child(4):last-child {
        margin-left: auto;
        margin-right: auto;
    }
    
    /* For 2 items total: center both together */
    .row.g-4.justify-content-center > .col-lg-4:first-child:nth-last-child(2) {
        margin-right: 0.5rem;
    }
    
    .row.g-4.justify-content-center > .col-lg-4:last-child:not(:nth-child(3)):not(:nth-child(6)) {
        margin-left: 0.5rem;
    }
}

/* Standardized Section Headers - All Centered - Minimal spacing */
section h2,
section .section-header h2,
.section-header h2 {
    text-align: center !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 2.5rem; /* display-6 equivalent */
    margin-top: 0;
    margin-bottom: 1rem;
}

/* Reduce spacing for all sections after header */
section {
    margin-top: 0;
    padding-top: 0;
}

/* NO spacing for first content elements - headers directly below header */
main > *:first-child,
main > .container > *:first-child,
main > .container-fluid > *:first-child {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

main h1:first-of-type,
main h2:first-of-type,
main h3:first-of-type,
main .hero-section {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Remove margin-bottom from last element before footer */
main > *:last-child,
main > .container > *:last-child,
main > .container-fluid > *:last-child,
main > div:last-child,
main > section:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

section h3,
.section-header h3 {
    text-align: center !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.75rem;
    margin-bottom: 0.75rem;
}

section h4,
.section-header h4 {
    text-align: center !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

section h5,
.section-header h5 {
    text-align: center !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

/* Standardized Card/Box Styling for Services, Values, and Lists */
.card {
    font-family: 'Inter', sans-serif;
    border-radius: 8px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* Consistent card borders for visual distinction */
.card.border {
    border: 1px solid #dee2e6 !important;
}

.card.border:hover {
    border-color: var(--gamscale-primary) !important;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.card-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
}

.card-text {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #6c757d;
}

/* Override card-text color on primary background */
.card.bg-primary .card-text,
.card.bg-primary.text-white .card-text {
    color: white !important;
}

/* Standardized List Item Styling */
.list-unstyled li {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    margin-bottom: 0.5rem;
}

.list-unstyled li i {
    font-size: 1rem;
    margin-right: 0.5rem;
}

/* Consistent Box Styling for Values, Services, and Features */
.value-box,
.service-box,
.feature-box {
    font-family: 'Inter', sans-serif;
    padding: 1.5rem;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.value-box:hover,
.service-box:hover,
.feature-box:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Standardized Icon Sizes */
.value-box i,
.service-box i,
.feature-box i,
.card-body i {
    font-size: 2.5rem;
    color: var(--gamscale-primary);
    margin-bottom: 1rem;
}

/* Ensure all service section headers are centered */
section[id^="software"],
section[id^="platforms"],
section[id^="consultancy"],
section[id^="ai"],
section[id^="support"] h2 {
    text-align: center !important;
}

/* Center all card titles within sections */
section .card-title {
    text-align: center !important;
}

/* Ensure text is visible on primary background cards */
.bg-primary .card-text,
.bg-primary .card-title,
.bg-primary.text-white .card-text,
.bg-primary.text-white .card-title,
.bg-primary.text-white p,
.bg-primary.text-white h3,
.bg-primary.text-white h4,
.bg-primary.text-white h5,
.card.bg-primary.text-white .card-text,
.card.bg-primary.text-white .card-title,
.card.bg-primary.text-white p {
    color: white !important;
}

/* Ensure consistent padding in all sections */
section.py-3,
section.py-4 {
    padding-top: 3rem !important;
    padding-bottom: 3rem !important;
}

/* Standardize hero section */
.hero-section h1,
.page-header h1 {
    text-align: center !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.hero-section .lead,
.page-header .lead {
    text-align: center !important;
    font-family: 'Inter', sans-serif;
}

/* Ensure all section containers have consistent padding */
section {
    font-family: 'Inter', sans-serif;
}

section .container {
    font-family: 'Inter', sans-serif;
}

/* Standardized Lead Text */
.lead {
    font-family: 'Inter', sans-serif;
    font-size: 1.125rem;
    font-weight: 400;
    line-height: 1.6;
}

/* Center all page headers */
.page-header h1,
.page-header .display-4 {
    text-align: center !important;
    font-family: 'Inter', sans-serif;
    font-weight: 600;
}

.page-header .lead {
    text-align: center !important;
    font-family: 'Inter', sans-serif;
}

/* Center card headers within sections */
section .card-header,
section .card-title {
    text-align: center !important;
}

/* Ensure consistent spacing in card bodies */
.card-body {
    padding: 2rem;
}

.card-body.text-center {
    text-align: center !important;
}

/* Standardized approach/process boxes */
.approach-box,
.process-box {
    text-align: center;
}

.approach-box .card-body,
.process-box .card-body {
    padding: 2rem;
}

.approach-box h5,
.approach-box .card-title,
.process-box h5,
.process-box .card-title {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 1.25rem;
    margin-top: 0;
    margin-bottom: 0.75rem;
}

.approach-box p,
.approach-box .card-text,
.process-box p,
.process-box .card-text {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    line-height: 1.6;
    color: #6c757d;
}

/* Center last item in approach section when there are 5 items */
.row.justify-content-center > .col-md-6.col-lg-4:nth-child(5) {
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Ensure consistent vertical spacing for last row items */
.row.g-4.justify-content-center > .col-lg-4:last-child,
.row.g-4.justify-content-center > .col-lg-4:nth-last-child(2) {
    margin-top: 0;
    margin-bottom: 0;
}

/* Responsive */
@media (max-width: 768px) {
    .public-header .portal-title {
        font-size: 1rem;
    }
    
    .admin-header .portal-title {
        font-size: 1rem;
    }
    
    section h2,
    section .section-header h2 {
        font-size: 2rem;
    }
    
    section h3 {
        font-size: 1.5rem;
    }
    
    .card-body {
        padding: 1.5rem;
    }
}

/* Ensure all clickable references are blue hyperlinks */
a:not(.btn):not(.page-link):not(.nav-link):not(.dropdown-item):not(.list-group-item-action) {
    color: #0d6efd !important;
    text-decoration: none;
}

a:not(.btn):not(.page-link):not(.nav-link):not(.dropdown-item):not(.list-group-item-action):hover {
    color: #0a58ca !important;
    text-decoration: underline;
}

/* Override for strong links - keep them blue */
a strong,
strong a {
    color: #0d6efd !important;
}

a:hover strong,
a strong:hover {
    color: #0a58ca !important;
}

/* ============================================
   RESPONSIVE DESIGN ENHANCEMENTS
   ============================================ */

/* Universal text wrapping and overflow handling */
* {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
}

/* Ensure all text content wraps properly */
p, span, div, a, li, td, th, label, input, textarea, select {
    word-wrap: break-word;
    overflow-wrap: break-word;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
}

/* Email links and long URLs */
a[href^="mailto:"],
a[href^="http://"],
a[href^="https://"] {
    word-break: break-all;
    overflow-wrap: anywhere;
    -webkit-hyphens: auto;
    -moz-hyphens: auto;
    -ms-hyphens: auto;
    hyphens: auto;
    display: inline-block;
    max-width: 100%;
}

/* Mobile-first responsive breakpoints */
/* Extra small devices (phones, 320px and up) */
@media (min-width: 320px) and (max-width: 575.98px) {
    body {
        font-size: 0.95rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }
    h6 { font-size: 0.95rem; }
    
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    /* Ensure all cards and boxes are responsive */
    .box-hover-shake,
    .card,
    .box {
        margin-left: 0.5rem;
        margin-right: 0.5rem;
        padding: 1rem !important;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    body {
        font-size: 0.98rem;
    }
    
    .container {
        max-width: 100%;
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    body {
        font-size: 1rem;
    }
    
    /* iPad and tablet specific fixes */
    .container {
        max-width: 100%;
        padding-left: 2rem;
        padding-right: 2rem;
    }
    
    /* Ensure proper text wrapping on tablets */
    p, div, span, a {
        word-wrap: break-word;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    
    /* Email links on tablets */
    a[href^="mailto:"] {
        word-break: break-all;
        overflow-wrap: anywhere;
        display: inline-block;
        max-width: 100%;
    }
    
    /* Cards and boxes on tablets */
    .box-hover-shake,
    .card {
        padding: 1.25rem !important;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) and (max-width: 1199.98px) {
    .container {
        max-width: 1140px;
    }
}

/* Extra large devices (large desktops, 1200px and up) */
@media (min-width: 1200px) {
    .container {
        max-width: 1320px;
    }
}

/* Landscape orientation fixes */
@media (orientation: landscape) and (max-height: 500px) {
    .public-header,
    .admin-header {
        padding-top: 0.25rem;
        padding-bottom: 0.25rem;
    }
    
    body {
        padding-top: 60px !important;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .company-logo,
    img {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets for mobile */
    a, button, .btn, .nav-link, .dropdown-item {
        min-height: 44px;
        min-width: 44px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Remove hover effects on touch devices */
    .box-hover-shake:hover {
        transform: none !important;
    }
}

/* Print styles */
@media print {
    .public-header,
    .admin-header,
    .navbar,
    .btn,
    .navbar-toggler {
        display: none !important;
    }
    
    body {
        padding-top: 0 !important;
    }
    
    a[href^="mailto:"]::after {
        content: " (" attr(href) ")";
        font-size: 0.8em;
        color: #666;
    }
}

/* ============================================
   BROWSER COMPATIBILITY FIXES
   ============================================ */

/* Flexbox fallbacks for older browsers */
@supports not (display: flex) {
    .d-flex {
        display: block;
    }
    
    .align-items-center {
        vertical-align: middle;
    }
}

/* Grid fallbacks */
@supports not (display: grid) {
    .row {
        display: block;
    }
    
    [class*="col-"] {
        display: block;
        width: 100%;
    }
}

/* CSS Variables fallback for IE11 */
/* Note: Modern browsers support CSS variables, but IE11 doesn't */
@media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
    :root {
        --gamscale-primary: #0066cc;
        --gamscale-secondary: #004499;
        --gamscale-accent: #00aaff;
        --gamscale-dark: #1a1a1a;
        --gamscale-light: #f8f9fa;
    }
}

/* Webkit-specific fixes (Safari, Chrome) */
@supports (-webkit-appearance: none) {
    /* Fix for Safari text rendering */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Fix for Safari flexbox issues */
    .d-flex {
        display: -webkit-flex;
        display: flex;
    }
}

/* Firefox-specific fixes */
@-moz-document url-prefix() {
    /* Firefox text rendering */
    body {
        -moz-font-smoothing: grayscale;
    }
}

/* Edge/IE11 specific fixes */
@supports (-ms-ime-align: auto) {
    /* Edge text rendering */
    body {
        -ms-font-smoothing: antialiased;
    }
}

/* Ensure images are responsive */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Responsive tables */
@media (max-width: 767.98px) {
    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    table thead {
        display: none;
    }
    
    table tbody,
    table tr,
    table td {
        display: block;
        width: 100%;
    }
    
    table td::before {
        content: attr(data-label) ": ";
        font-weight: bold;
    }
}

/* Responsive forms */
@media (max-width: 767.98px) {
    .form-control,
    .form-select,
    textarea {
        font-size: 16px; /* Prevents zoom on iOS */
        width: 100%;
    }
    
    input[type="email"],
    input[type="tel"],
    input[type="url"] {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Ensure modals are responsive */
@media (max-width: 575.98px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

/* Responsive typography scaling */
@media (max-width: 575.98px) {
    html {
        font-size: 14px;
    }
}

@media (min-width: 576px) and (max-width: 767.98px) {
    html {
        font-size: 15px;
    }
}

@media (min-width: 768px) {
    html {
        font-size: 16px;
    }
}
