:root {
    --nl-green: #8CC63F;
    --nl-dark-green: #7AB62F;
    --nl-light-green: #A8D865;
    --nl-text-dark: #333333;
    --nl-text-light: #666666;
    --nl-border: #e0e0e0;
}

html, body {
    font-family: 'Source Sans Pro', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    color: var(--nl-text-dark);
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--nl-text-dark);
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: var(--nl-green);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover, .btn-link:hover {
    color: var(--nl-dark-green);
    text-decoration: underline;
}

.btn-primary {
    color: #fff;
    background-color: var(--nl-green);
    border-color: var(--nl-green);
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background-color: var(--nl-dark-green);
    border-color: var(--nl-dark-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(140, 198, 63, 0.3);
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--nl-green);
    outline: none;
}

/* Northern Lights Header */
.nl-header {
    background-color: white;
    border-bottom: 3px solid var(--nl-green);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.nl-page-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0.5rem 0 0 0;
    padding: 0;
    color: var(--nl-text-dark);
}

/* Hide page title on desktop - it should only show on mobile */
@media (min-width: 1025px) {
    .nl-page-title {
        display: none;
    }
}

.nl-header-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
}

.nl-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
}

/* ========================================
   MOBILE MENU STYLES - START
   ======================================== */

/* Desktop-only elements - hidden on mobile */
.desktop-only {
    display: block;
}

/* Logo and toggle wrapper for mobile - HIDDEN on desktop */
.nl-logo-mobile-wrapper {
    display: none; /* Hidden on desktop, only shown in mobile media query */
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 1rem;
}

.mobile-logo-link {
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

/* Mobile menu toggle button */
.mobile-menu-toggle {
    display: none; /* Hidden on desktop */
    background: transparent;
    border: 2px solid var(--nl-green);
    border-radius: 6px;
    font-size: 1.25rem;
    color: var(--nl-text-dark);
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    transition: all 0.2s ease;
    gap: 0.25rem;
    align-items: center;
    flex-shrink: 0;
}

.mobile-menu-toggle:hover {
    background: var(--nl-green);
    color: white;
}

.mobile-menu-toggle:active {
    transform: scale(0.95);
}

.mobile-menu-toggle i {
    display: inline-block;
    line-height: 1;
}

/* Mobile navigation menu container */
.mobile-nav-menu {
    display: none; /* Hidden on desktop */
    width: 100%;
    background: white;
    border-radius: 8px;
    margin-top: 1rem;
    border: 2px solid var(--nl-green);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

/* Mobile nav wrapper */
.mobile-nav {
    display: flex;
    flex-direction: column;
    padding: 0;
    margin: 0;
}

/* Mobile user section */
.mobile-user-section {
    border-bottom: 2px solid var(--nl-green);
    background: #f8f9fa;
}

/* Mobile user info header */
.mobile-user-info {
    padding: 1rem;
    font-weight: 700;
    font-size: 1.05rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--nl-text-dark);
    background: white;
    border-bottom: 1px solid var(--nl-border);
}

.mobile-user-info i {
    font-size: 1.5rem;
    color: var(--nl-green);
}

/* Mobile navigation links */
.mobile-nav-link {
    color: var(--nl-text-dark);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--nl-border);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    background: white;
    cursor: pointer;
}

.mobile-nav-link:last-child {
    border-bottom: none;
}

.mobile-nav-link:hover {
    background: var(--nl-light-green);
    color: var(--nl-text-dark);
    text-decoration: none;
    padding-left: 1.25rem;
}

.mobile-nav-link i {
    font-size: 1.1rem;
    color: var(--nl-green);
    width: 1.25rem;
    text-align: center;
}

/* Indented mobile nav links (for sub-items) */
.mobile-nav-indent {
    padding-left: 2.5rem;
    font-size: 0.95rem;
    font-weight: 500;
    background: #f8f9fa;
}

.mobile-nav-indent:hover {
    padding-left: 2.75rem;
    background: var(--nl-light-green);
}

/* Mobile logout button */
.mobile-logout-btn {
    color: #dc3545;
    border: none;
    width: 100%;
    text-align: left;
    font-weight: 600;
}

.mobile-logout-btn:hover {
    background: #ffebee;
    color: #c62828;
}

.mobile-logout-btn i {
    color: #dc3545;
}

/* ========================================
   MOBILE MENU STYLES - END
   ======================================== */

/* Desktop navigation wrapper - always visible on desktop */
.desktop-nav-wrapper {
    display: flex;
    flex-direction: column;
    width: 100%;
    gap: 0;
}

.nl-nav-wrapper {
    display: block;
    width: 100%;
}

.nl-logo img {
    height: 50px;
    width: auto;
}

.nl-nav {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.nl-nav .nav-link {
    color: var(--nl-text-dark);
    font-weight: 600;
    font-size: 1rem;
    text-decoration: none;
    transition: color 0.3s ease;
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
}

.nl-nav .nav-link:hover {
    color: var(--nl-green);
    border-bottom-color: var(--nl-green);
    text-decoration: none;
}

.nl-nav .nav-link-sub {
    padding-left: 1.5rem;
    font-size: 0.95rem;
    font-weight: 500;
}

/* Main Content */
.nl-main {
    min-height: calc(100vh - 200px);
    background-color: #f8f9fa;
    padding-bottom: 40px; /* Add padding for footer */
}

/* Public home layout helpers */
.public-home-layout {
    display: block;
}

.public-home-forms,
.public-home-hero {
    width: 100%;
}

/* Place hero below forms on mobile */
@media (max-width: 1024px) {
    .public-home-layout {
        display: flex;
        flex-direction: column;
    }

    .public-home-forms {
        order: 1;
    }

    .public-home-hero {
        order: 2;
    }
}

/* Desktop: Always show navigation expanded */
@media (min-width: 769px) {
    .nl-nav-expander {
        max-height: none !important;
        opacity: 1 !important;
        padding: 0 !important;
        overflow: visible !important;
    }
}

.nl-content {
    /* max-width removed to allow full-width admin pages */
    margin: 0;
    padding: 0;
}

/* Hero Section */
.nl-hero {
    background-color: #2d2d2d; /* Charcoal color */
    color: white;
    padding: 3rem 2rem;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.nl-hero-content {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 4rem;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.nl-hero-logo-section {
    display: flex;
    justify-content: flex-end;
}

.nl-hero-logo {
    height: 120px;
    width: auto;
    max-width: 100%;
}

.nl-hero-contact {
    text-align: left;
    border-left: 2px solid var(--nl-green);
    border-right: 2px solid var(--nl-green);
    padding: 0 3rem;
}

.nl-hero-contact-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    color: white;
    letter-spacing: 2px;
}

.nl-hero-contact-details {
    display: flex;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.nl-hero-contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nl-hero-contact-item i {
    color: var(--nl-green);
    font-size: 1.2rem;
}

.nl-hero-contact-link {
    color: var(--nl-green);
    text-decoration: none;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.nl-hero-contact-link:hover {
    color: white;
}

.nl-hero-social {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.nl-hero-social-link {
    background-color: var(--nl-green);
    color: white;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    text-decoration: none;
    font-size: 1.2rem;
    transition: background-color 0.3s ease;
}

.nl-hero-social-link:hover {
    background-color: var(--nl-dark-green);
}

.nl-hero-badges {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
}

.nl-hero-badge-top {
    width: 100%;
}

.nl-hero-badge-large {
    height: 80px;
    width: auto;
}

.nl-hero-badge-row {
    display: flex;
    gap: 0.75rem;
}

.nl-hero-badge {
    height: 50px;
    width: auto;
}

.nl-hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: white;
}

.nl-hero-subtitle {
    font-size: 1.5rem;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.nl-hero-description {
    font-size: 1.1rem;
    opacity: 0.9;
}

/* Footer */
.nl-footer {
    background-color: var(--nl-text-dark);
    color: white;
    padding: 2rem;
    text-align: center;
    margin-top: 3rem;
}

.nl-footer-container {
    max-width: 1200px;
    margin: 0 auto;
}

.nl-footer p {
    margin: 0.5rem 0;
    font-size: 0.9rem;
}

.content {
    padding-top: 1.1rem;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

/* Survey/Likert field grid styling */
/* Single-row survey (horizontal radio buttons) */
.survey-field.single-row {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin: 1rem 0;
    max-width: 100%;
    width: 100%;
}

.survey-field.single-row .survey-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 0 1 auto;
    min-width: 70px;
}

.survey-field.single-row .survey-option label {
    font-size: 0.875rem;
    text-align: center;
    white-space: nowrap;
    margin: 0;
}

.survey-field.single-row .survey-option input[type="radio"] {
    cursor: pointer;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
}

/* Multi-row survey (table) */
.survey-field table {
    margin-bottom: 0;
    font-size: 0.875rem;
}

.survey-field thead th {
    font-weight: 600;
    font-size: 0.8rem;
    background-color: #f8f9fa;
    vertical-align: middle;
    padding: 0.5rem 0.25rem;
    text-align: center;
    white-space: nowrap;
    min-width: 60px;
}

.survey-field thead th:first-child {
    text-align: left;
    min-width: 200px;
    white-space: normal;
}

.survey-field tbody td {
    vertical-align: middle;
    padding: 0.5rem 0.25rem;
    text-align: center;
}

.survey-field tbody td:first-child {
    font-weight: 500;
    text-align: left;
    padding-left: 0.75rem;
}

.survey-field .form-check-input {
    cursor: pointer;
    width: 1.25rem;
    height: 1.25rem;
    margin: 0;
}

.survey-field tbody tr:hover {
    background-color: #f8f9fa;
}

/* Handle wide survey tables (10+ columns) */
.survey-field.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 768px) {
    .survey-field thead th {
        font-size: 0.7rem;
        padding: 0.4rem 0.15rem;
        min-width: 50px;
    }
    
    .survey-field tbody td {
        padding: 0.4rem 0.15rem;
    }
    
    .survey-field .form-check-input {
        width: 1rem;
        height: 1rem;
    }
}

/* Signature Pad Styling */
.signature-pad-container {
    display: inline-block;
    width: 100%;
}

.signature-canvas {
    border: 2px dashed #ccc;
    border-radius: 4px;
    cursor: crosshair;
    background-color: #fff;
    touch-action: none;
    width: 100%;
    max-width: 600px;
    height: 200px;
}

.signature-canvas.readonly {
    cursor: default;
    border-style: solid;
    background-color: #f8f9fa;
}

.signature-pad-controls {
    display: flex;
    gap: 0.5rem;
}

.signature-display {
    padding: 1rem;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    display: inline-block;
}

.signature-image {
    max-width: 100%;\n    height: auto;
    border: 1px solid #ccc;
    background-color: #fff;
}

@media (max-width: 1024px) {
    .signature-canvas {
        height: 150px;
    }
    
    .nl-header-container {
        padding: 1rem;
    }
    
    /* ========================================
       MOBILE RESPONSIVE OVERRIDES - START
       ======================================== */
    
    /* Hide desktop-only elements on mobile */
    .desktop-only {
        display: none !important;
    }
    
    /* Show mobile menu toggle on mobile */
    .mobile-menu-toggle {
        display: flex !important;
    }
    
    /* Show mobile menu when expanded */
    .mobile-nav-menu {
        display: block !important;
    }
    
    /* CRITICAL: Hide desktop navigation completely on mobile */
    .desktop-nav-wrapper {
        display: none !important;
        visibility: hidden !important;
    }
    
    /* Hide logo wrapper on desktop, show mobile wrapper */
    .nl-logo-mobile-wrapper {
        display: flex !important;
    }
    
    /* ========================================
       MOBILE RESPONSIVE OVERRIDES - END
       ======================================== */
    
    .nl-nav {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }
    
    /* Hero adjustments for mobile */
    .nl-hero {
        padding: 2rem 1rem;
    }
    
    .nl-hero-content {
        grid-template-columns: 1fr;
        gap: 2rem;
        text-align: center;
    }
    
    .nl-hero-logo-section {
        justify-content: center;
    }
    
    .nl-hero-logo {
        height: 80px;
    }
    
    .nl-hero-contact {
        border: none;
        padding: 0;
        border-top: 2px solid var(--nl-green);
        border-bottom: 2px solid var(--nl-green);
        padding: 1.5rem 0;
    }
    
    .nl-hero-contact-title {
        font-size: 1.2rem;
    }
    
    .nl-hero-contact-details {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }
    
    .nl-hero-contact-item {
        justify-content: center;
    }
    
    .nl-hero-contact-link {
        font-size: 0.95rem;
    }
    
    .nl-hero-social {
        justify-content: center;
    }
    
    .nl-hero-badges {
        align-items: center;
    }
    
    .nl-hero-badge-large {
        height: 60px;
    }
    
    .nl-hero-badge {
        height: 40px;
    }
    
    .nl-hero-title {
        font-size: 2rem;
    }
    
    .nl-hero-subtitle {
        font-size: 1.2rem;
    }
    
    .nl-content {
        padding: 1rem;
    }
}

/* Card enhancements */
.card {
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.card-title {
    color: var(--nl-text-dark);
    font-weight: 600;
}

/* Page wrapper */
.page {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.page .nl-main {
    flex: 1;
}

/* ========================================
   MOBILE-RESPONSIVE BUTTON LAYOUTS
   ======================================== */

/* Modal footer - responsive button layout */
.modal-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 1rem;
}

/* Mobile: Stack buttons vertically, full width */
@media (max-width: 768px) {
    .modal-footer {
        flex-direction: column-reverse; /* Cancel on top, Save on bottom for thumb reach */
        gap: 0.75rem;
    }
    
    .modal-footer .btn {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
    
    /* Remove left margin on mobile for proper full-width */
    .modal-footer .btn.ms-2,
    .modal-footer .btn.ms-1 {
        margin-left: 0 !important;
    }
}

/* Action button groups - used in settings pages */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    align-items: center;
}

@media (max-width: 768px) {
    .action-buttons {
        flex-direction: column-reverse;
        width: 100%;
    }
    
    .action-buttons .btn {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
    
    /* Remove spacing classes on mobile */
    .action-buttons .btn.ms-2,
    .action-buttons .btn.ms-1,
    .action-buttons .btn.me-2,
    .action-buttons .btn.me-1 {
        margin: 0 !important;
    }
}

/* Form action buttons at bottom of forms */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid var(--nl-border);
}

@media (max-width: 768px) {
    .form-actions {
        flex-direction: column-reverse;
        gap: 0.75rem;
    }
    
    .form-actions .btn {
        width: 100%;
        padding: 0.875rem 1rem;
        font-size: 1rem;
    }
    
    /* Remove spacing classes on mobile */
    .form-actions .btn.ms-2,
    .form-actions .btn.ms-1,
    .form-actions .btn.me-2,
    .form-actions .btn.me-1 {
        margin: 0 !important;
    }
}

/* Button group in cards/headers */
.btn-group-responsive {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

@media (max-width: 768px) {
    .btn-group-responsive {
        flex-direction: column;
        width: 100%;
    }
    
    .btn-group-responsive .btn {
        width: 100%;
        justify-content: center;
    }
}

/* Ensure buttons are touch-friendly on mobile */
@media (max-width: 768px) {
    .btn {
        min-height: 44px; /* iOS recommended touch target size */
        font-size: 1rem; /* Prevent zoom on iOS */
    }
    
    /* Icon buttons should remain square */
    .btn.btn-sm.rounded-circle,
    .btn-icon-only {
        width: 44px;
        height: 44px;
    }
    
    /* Adjust button padding for better mobile UX */
    .btn-lg {
        padding: 1rem 1.5rem;
    }
}

/* Modal adjustments for mobile */
@media (max-width: 768px) {
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
    
    .modal-lg,
    .modal-xl {
        max-width: calc(100% - 1rem);
    }
    
    .modal-body {
        padding: 1rem;
    }
    
    .modal-header {
        padding: 1rem;
    }
    
    .modal-footer {
        padding: 1rem;
    }
    
    /* Make modal content scrollable on small screens */
    .modal-content {
        max-height: 95vh;
        display: flex;
        flex-direction: column;
    }
    
    .modal-body {
        overflow-y: auto;
        flex: 1;
    }
}

/* Table responsiveness for mobile */
@media (max-width: 768px) {
    .table-responsive {
        border: none;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Make cards stack properly on mobile */
    .card {
        margin-bottom: 1rem;
    }
    
    /* Adjust card headers with buttons */
    .card-header {
        padding: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

/* Form controls mobile optimization */
@media (max-width: 768px) {
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents iOS zoom */
        min-height: 44px;
    }
    
    textarea.form-control {
        min-height: 100px;
    }
}

/* Responsive spacing utilities */
@media (max-width: 768px) {
    /* Reduce excessive spacing on mobile */
    .mb-4 {
        margin-bottom: 1.5rem !important;
    }
    
    .mt-4 {
        margin-top: 1.5rem !important;
    }
    
    .py-4 {
        padding-top: 1.5rem !important;
        padding-bottom: 1.5rem !important;
    }
    
    /* Reduce container padding on mobile */
    .container,
    .container-fluid {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}
