/* ==========================================================================
   Table of Contents:
   1. CSS Variables & Root Styles
   2. Base Styles & Typography
   3. Buttons & Form Elements
   4. Layout Components (Cards, Containers, etc.)
   5. Navigation
   6. Map Components
   7. Task Management
   8. Challenge Components
   9. Camera & Photo Upload
   10. Media Queries
   11. Utility Classes & Animation
   12. Special States (loading, dark mode, etc.)
   ========================================================================== */

/* ==========================================================================
   1. CSS Variables & Root Styles
   ========================================================================== */
:root {
    /* Primary Colors */
    --primary-color: #1a73e8;
    --primary-hover: #0d5bbd;
    --secondary-color: #4285f4;
    
    /* Status Colors */
    --success-color: #34a853;
    --danger-color: #ea4335;
    --warning-color: #fbbc05;
    --info-color: #4285f4;
    
    /* Neutral Colors */
    --light-color: #f8f9fa;
    --dark-color: #202124;
    
    /* Grays */
    --gray-50: #f8f9fa;
    --gray-100: #f1f3f4;
    --gray-200: #e8eaed;
    --gray-300: #dadce0;
    --gray-400: #bdc1c6;
    --gray-500: #9aa0a6;
    --gray-600: #5f6368;
    --gray-700: #3c4043;
    --gray-800: #202124;
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    
    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --radius-full: 999px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-xl: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Font Sizes */
    --font-xs: 0.75rem;
    --font-sm: 0.875rem;
    --font-md: 1rem;
    --font-lg: 1.125rem;
    --font-xl: 1.25rem;
    --font-2xl: 1.5rem;
    --font-3xl: 1.875rem;
    --font-4xl: 2.25rem;
    
    /* Z-index */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal: 1040;
    --z-popover: 1050;
    --z-toast: 1060;
    --z-tooltip: 1070;
}

/* ==========================================================================
   2. Base Styles & Typography
   ========================================================================== */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--light-color);
    color: var(--gray-700);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: color var(--transition-normal), background-color var(--transition-normal);
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: var(--space-md);
    color: var(--gray-800);
}

h1 { font-size: var(--font-3xl); }
h2 { font-size: var(--font-2xl); }
h3 { font-size: var(--font-xl); }
h4 { font-size: var(--font-lg); }
h5 { font-size: var(--font-md); }
h6 { font-size: var(--font-sm); }

p {
    margin-bottom: var(--space-md);
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover {
    color: var(--primary-hover);
}

small {
    font-size: var(--font-sm);
    color: var(--gray-600);
}

/* ==========================================================================
   3. Buttons & Form Elements
   ========================================================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    white-space: nowrap;
    vertical-align: middle;
    user-select: none;
    border: 1px solid transparent;
    padding: 0.5rem 1rem;
    font-size: var(--font-md);
    line-height: 1.5;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25);
}

.btn:after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    background-image: radial-gradient(circle, #fff 10%, transparent 10.01%);
    background-repeat: no-repeat;
    background-position: 50%;
    transform: scale(10, 10);
    opacity: 0;
    transition: transform .5s, opacity 1s;
}

.btn:active:after {
    transform: scale(0, 0);
    opacity: .3;
    transition: 0s;
}

/* Button variants */
.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.btn-primary:hover, .btn-primary:focus {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover, .btn-secondary:focus {
    background-color: #3b78e7;
    border-color: #3b78e7;
    color: white;
}

.btn-success {
    background-color: var(--success-color);
    border-color: var(--success-color);
    color: white;
}

.btn-success:hover, .btn-success:focus {
    background-color: #2d9248;
    border-color: #2d9248;
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    border-color: var(--danger-color);
    color: white;
}

.btn-danger:hover, .btn-danger:focus {
    background-color: #d33426;
    border-color: #d33426;
    color: white;
}

.btn-warning {
    background-color: var(--warning-color);
    border-color: var(--warning-color);
    color: var(--gray-800);
}

.btn-warning:hover, .btn-warning:focus {
    background-color: #f0b400;
    border-color: #f0b400;
    color: var(--gray-800);
}

.btn-info {
    background-color: var(--info-color);
    border-color: var(--info-color);
    color: white;
}

.btn-info:hover, .btn-info:focus {
    background-color: #3b78e7;
    border-color: #3b78e7;
    color: white;
}

.btn-light {
    background-color: var(--light-color);
    border-color: var(--gray-300);
    color: var(--gray-700);
}

.btn-light:hover, .btn-light:focus {
    background-color: var(--gray-100);
    border-color: var(--gray-400);
    color: var(--gray-800);
}

.btn-dark {
    background-color: var(--dark-color);
    border-color: var(--dark-color);
    color: white;
}

.btn-dark:hover, .btn-dark:focus {
    background-color: var(--gray-700);
    border-color: var(--gray-700);
    color: white;
}

.btn-outline-primary {
    color: var(--primary-color);
    border-color: var(--primary-color);
    background-color: transparent;
}

.btn-outline-primary:hover, .btn-outline-primary:focus {
    color: white;
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-outline-secondary {
    color: var(--secondary-color);
    border-color: var(--secondary-color);
    background-color: transparent;
}

.btn-outline-secondary:hover, .btn-outline-secondary:focus {
    color: white;
    background-color: var(--secondary-color);
    border-color: var(--secondary-color);
}

.btn-link {
    font-weight: 400;
    color: var(--primary-color);
    background-color: transparent;
    border: none;
}

.btn-link:hover {
    color: var(--primary-hover);
    text-decoration: underline;
    background-color: transparent;
    border-color: transparent;
}

/* Button sizes */
.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: var(--font-sm);
    border-radius: var(--radius-sm);
}

.btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: var(--font-lg);
    border-radius: var(--radius-lg);
}

.btn-xl {
    padding: 1rem 2rem;
    font-size: var(--font-xl);
    border-radius: var(--radius-lg);
}

/* Button states */
.btn.disabled, .btn:disabled {
    opacity: 0.65;
    pointer-events: none;
}

/* Button with icons */
.btn i {
    margin-right: 0.5rem;
    font-size: 1.1em;
}

.btn i:only-child {
    margin-right: 0;
}

/* Responsive button text sizing for all buttons */
@media (max-width: 1400px) {
    .btn {
        font-size: 0.9rem;
    }
    
    .btn-sm {
        font-size: 0.8rem;
    }
    
    .btn-lg {
        font-size: 1rem;
    }
    
    .btn-xl {
        font-size: 1.1rem;
    }
}

@media (max-width: 1200px) {
    .btn {
        font-size: 0.85rem;
        padding: 0.4rem 0.8rem;
    }
    
    .btn-sm {
        font-size: 0.75rem;
        padding: 0.2rem 0.4rem;
    }
    
    .btn-lg {
        font-size: 0.95rem;
        padding: 0.6rem 1.2rem;
    }
    
    .btn-xl {
        font-size: 1rem;
        padding: 0.8rem 1.6rem;
    }
}

@media (max-width: 992px) {
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .btn-sm {
        font-size: 0.8rem;
        padding: 0.25rem 0.5rem;
    }
    
    .btn-lg {
        font-size: 1rem;
        padding: 0.75rem 1.5rem;
    }
    
    .btn-xl {
        font-size: 1.1rem;
        padding: 1rem 2rem;
    }
}

@media (max-width: 768px) {
    .btn {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .btn-sm {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
    
    .btn-lg {
        font-size: 0.9rem;
        padding: 0.6rem 1.2rem;
    }
    
    .btn-xl {
        font-size: 1rem;
        padding: 0.8rem 1.6rem;
    }
}

/* Form Controls */
.form-control {
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    font-size: var(--font-md);
    line-height: 1.5;
    color: var(--gray-700);
    background-color: white;
    background-clip: padding-box;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-control:focus {
    color: var(--gray-800);
    background-color: white;
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25);
}

.form-control::placeholder {
    color: var(--gray-500);
    opacity: 1;
}

.form-control:disabled,
.form-control[readonly] {
    background-color: var(--gray-100);
    opacity: 1;
}

.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--gray-700);
}

.form-text {
    margin-top: 0.25rem;
    font-size: var(--font-sm);
    color: var(--gray-600);
}

.form-select {
    display: block;
    width: 100%;
    padding: 0.5rem 2.25rem 0.5rem 0.75rem;
    font-size: var(--font-md);
    font-weight: 400;
    line-height: 1.5;
    color: var(--gray-700);
    background-color: white;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%235f6368' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    appearance: none;
}

.form-select:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25);
}

.form-check {
    display: block;
    min-height: 1.5rem;
    padding-left: 1.5em;
    margin-bottom: 0.125rem;
}

.form-check-input {
    width: 1em;
    height: 1em;
    margin-top: 0.25em;
    vertical-align: top;
    background-color: white;
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
    border: 1px solid var(--gray-400);
    appearance: none;
    color-adjust: exact;
    transition: background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.form-check-input[type="checkbox"] {
    border-radius: var(--radius-sm);
}

.form-check-input[type="radio"] {
    border-radius: 50%;
}

.form-check-input:checked {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.form-check-input:checked[type="checkbox"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
}

.form-check-input:checked[type="radio"] {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='2' fill='%23fff'/%3e%3c/svg%3e");
}

.form-check-input:focus {
    border-color: var(--primary-color);
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25);
}

.form-check-label {
    color: var(--gray-700);
}

/* ==========================================================================
   4. Layout Components (Cards, Containers, etc.)
   ========================================================================== */

/* Helper function to determine if a color is light or dark */
/* We'll use CSS custom properties to handle this */

/* Card */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    word-wrap: break-word;
    background-color: white;
    background-clip: border-box;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: all var(--transition-normal);
}

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

.card-header {
    padding: 1rem 1.25rem;
    margin-bottom: 0;
    background-color: var(--gray-100);
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
}

.card-header:first-child {
    border-radius: calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px) 0 0;
}

.card-body {
    flex: 1 1 auto;
    padding: 1.25rem;
}

.card-footer {
    padding: 1rem 1.25rem;
    background-color: var(--gray-100);
    border-top: 1px solid var(--gray-200);
}

.card-footer:last-child {
    border-radius: 0 0 calc(var(--radius-lg) - 1px) calc(var(--radius-lg) - 1px);
}

/* Smart card header with dynamic text color based on background */
.card-header.bg-primary,
.card-header.bg-secondary {
    color: white;
}

/* For club branding - we'll use CSS to determine text color dynamically */
.card-header[style*="background-color"] {
    color: white;
}

/* Modal */
.modal-content {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    pointer-events: auto;
    background-color: white;
    background-clip: padding-box;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    outline: 0;
    box-shadow: var(--shadow-xl);
}

.modal-header {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--gray-200);
    border-top-left-radius: calc(var(--radius-lg) - 1px);
    border-top-right-radius: calc(var(--radius-lg) - 1px);
    background-color: var(--secondary-color);
    color: white;
}

.modal-body {
    position: relative;
    flex: 1 1 auto;
    padding: 1rem;
}

.modal-footer {
    display: flex;
    flex-wrap: wrap;
    flex-shrink: 0;
    align-items: center;
    justify-content: flex-end;
    padding: 0.75rem;
    border-top: 1px solid var(--gray-200);
    border-bottom-right-radius: calc(var(--radius-lg) - 1px);
    border-bottom-left-radius: calc(var(--radius-lg) - 1px);
}

.modal-title {
    margin-bottom: 0;
    line-height: 1.5;
}

/* Alert */
.alert {
    position: relative;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
}

.alert-primary {
    color: #084298;
    background-color: #cfe2ff;
    border-color: #b6d4fe;
}

.alert-secondary {
    color: #41464b;
    background-color: #e2e3e5;
    border-color: #d3d6d8;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-color: #badbcc;
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-color: #f5c2c7;
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-color: #ffecb5;
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-color: #b6effb;
}

.alert-light {
    color: #636464;
    background-color: #fefefe;
    border-color: #fdfdfe;
}

.alert-dark {
    color: #141619;
    background-color: #d3d3d4;
    border-color: #bcbebf;
}

.alert-dismissible {
    padding-right: 3rem;
}

.alert-dismissible .btn-close {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    padding: 1.25rem 1rem;
}

/* Badge */
.badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    color: white;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--radius-md);
}

.badge-primary {
    color: white;
    background-color: var(--primary-color);
}

.badge-secondary {
    color: white;
    background-color: var(--secondary-color);
}

.badge-success {
    color: white;
    background-color: var(--success-color);
}

.badge-danger {
    color: white;
    background-color: var(--danger-color);
}

.badge-warning {
    color: var(--gray-800);
    background-color: var(--warning-color);
}

.badge-info {
    color: white;
    background-color: var(--info-color);
}

.badge-light {
    color: var(--gray-800);
    background-color: var(--light-color);
}

.badge-dark {
    color: white;
    background-color: var(--dark-color);
}

/* Toast */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: var(--z-toast);
}

.toast {
    width: 350px;
    max-width: 100%;
    font-size: 0.875rem;
    pointer-events: auto;
    background-color: white;
    background-clip: padding-box;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-md);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity var(--transition-normal), transform var(--transition-normal);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-header {
    display: flex;
    align-items: center;
    padding: 0.5rem 0.75rem;
    color: var(--gray-600);
    background-color: rgba(255, 255, 255, 0.85);
    background-clip: padding-box;
    border-bottom: 1px solid var(--gray-200);
    border-top-left-radius: calc(var(--radius-md) - 1px);
    border-top-right-radius: calc(var(--radius-md) - 1px);
}

.toast-body {
    padding: 0.75rem;
}

/* Progress */
.progress {
    display: flex;
    height: 1rem;
    overflow: hidden;
    font-size: 0.75rem;
    background-color: var(--gray-200);
    border-radius: var(--radius-md);
}

.progress-bar {
    display: flex;
    flex-direction: column;
    justify-content: center;
    overflow: hidden;
    color: white;
    text-align: center;
    white-space: nowrap;
    background-color: var(--primary-color);
    transition: width 0.6s ease;
}

/* ==========================================================================
   5. Navigation
   ========================================================================== */
.navbar {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background-color: white;
    box-shadow: var(--shadow-md);
}

.navbar-brand {
    display: inline-block;
    padding-top: 0.3125rem;
    padding-bottom: 0.3125rem;
    margin-right: 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    line-height: inherit;
    white-space: nowrap;
    color: var(--gray-800);
    text-decoration: none;
}

.navbar-nav {
    display: flex;
    flex-direction: column;
    padding-left: 0;
    margin-bottom: 0;
    list-style: none;
}

.navbar-nav .nav-link {
    padding-right: 0.5rem;
    padding-left: 0.5rem;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.navbar-nav .dropdown-menu {
    position: static;
    float: none;
}

.navbar-collapse {
    flex-basis: 100%;
    flex-grow: 1;
    align-items: center;
}

.navbar-toggler {
    padding: 0.25rem 0.75rem;
    font-size: 1.25rem;
    line-height: 1;
    background-color: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    transition: box-shadow var(--transition-fast);
}

.navbar-toggler:focus {
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(26, 115, 232, 0.25);
}

.navbar-dark {
    background-color: var(--gray-800);
}

.navbar-dark .navbar-brand {
    color: white;
}

.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.75);
}

.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link:focus {
    color: white;
}

.navbar-dark .navbar-nav .nav-link.active {
    color: white;
    font-weight: 500;
}

.navbar-dark .navbar-toggler {
    color: rgba(255, 255, 255, 0.75);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Admin Panel Navigation */
.admin-nav {
    background: linear-gradient(135deg, var(--gray-800) 0%, #000 100%);
    box-shadow: var(--shadow-lg);
}

.admin-nav .navbar-brand {
    color: white;
    font-weight: 700;
}

.admin-nav .nav-link {
    color: rgba(255, 255, 255, 0.75);
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
}

.admin-nav .nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
}

.admin-nav .nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
}

/* User Navigation */
.user-nav .nav-link {
    font-size: 0.9rem;
    transition: all var(--transition-fast);
}

.user-nav .dropdown-menu {
    font-size: 0.85rem;
}

.user-nav .dropdown-item {
    font-size: 0.85rem;
    padding: 0.4rem 1rem;
}

/* Responsive navigation text for all navbars */
@media (max-width: 1400px) {
    .navbar-nav .nav-link {
        font-size: 0.85rem;
    }
    
    .dropdown-item {
        font-size: 0.8rem;
    }
    
    .dropdown-toggle {
        font-size: 0.85rem;
    }
}

@media (max-width: 1200px) {
    .navbar-nav .nav-link {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .dropdown-item {
        font-size: 0.75rem;
        padding: 0.3rem 0.8rem;
    }
    
    .dropdown-toggle {
        font-size: 0.8rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
}

@media (max-width: 992px) {
    .navbar-nav .nav-link {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .dropdown-item {
        font-size: 0.85rem;
        padding: 0.4rem 1rem;
    }
    
    .dropdown-toggle {
        font-size: 0.9rem;
    }
}

@media (max-width: 768px) {
    .navbar-nav .nav-link {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    .dropdown-item {
        font-size: 0.75rem;
        padding: 0.3rem 0.8rem;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
}

/* ==========================================================================
   6. Map Components
   ========================================================================== */
#map {
    height: 50vh;
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--gray-300);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    min-height: 300px;
}

.address-search {
    position: relative;
    margin-bottom: 1rem;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--z-dropdown);
    background: white;
    border: 1px solid var(--gray-300);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
}

.search-result-item {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background-color var(--transition-fast);
}

.search-result-item:hover {
    background-color: var(--gray-100);
}

.search-result-item:last-child {
    border-bottom: none;
}


/* ==========================================================================
   Leaflet Map Customizations
   ========================================================================== */

/* Custom marker icons for Leaflet */
.custom-marker-icon {
    background: none;
    border: none;
}

.custom-marker-icon .marker-pin {
    width: 30px;
    height: 30px;
    border-radius: 50% 50% 50% 0;
    background: var(--primary-color);
    position: absolute;
    transform: rotate(-45deg);
    left: 50%;
    top: 50%;
    margin: -15px 0 0 -15px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.custom-marker-icon .marker-pin::after {
    content: '';
    width: 18px;
    height: 18px;
    margin: 6px 0 0 6px;
    background: #fff;
    position: absolute;
    border-radius: 50%;
}

.custom-marker-icon .marker-number {
    position: absolute;
    width: 30px;
    height: 30px;
    left: 0;
    top: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: var(--primary-color);
    z-index: 1;
}

/* Numbered marker style (circular) */
.numbered-marker {
    background: var(--primary-color);
    border: 3px solid #fff;
    border-radius: 50%;
    color: #fff;
    font-weight: bold;
    font-size: 14px;
    text-align: center;
    line-height: 28px;
    width: 34px;
    height: 34px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.numbered-marker.has-submissions {
    background: var(--warning-color);
    color: var(--gray-800);
}

/* Leaflet popup customizations */
.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
}

.leaflet-popup-content {
    margin: 12px 16px;
    font-size: 14px;
}

.leaflet-popup-tip {
    box-shadow: var(--shadow-md);
}

/* Custom autocomplete dropdown for Nominatim */
.nominatim-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: var(--z-dropdown);
    background: white;
    border: 1px solid var(--gray-300);
    border-top: none;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 250px;
    overflow-y: auto;
}

.nominatim-autocomplete-item {
    padding: 10px 15px;
    border-bottom: 1px solid var(--gray-200);
    cursor: pointer;
    transition: background-color var(--transition-fast);
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.nominatim-autocomplete-item:hover,
.nominatim-autocomplete-item.selected {
    background-color: var(--gray-100);
}

.nominatim-autocomplete-item:last-child {
    border-bottom: none;
}

.nominatim-autocomplete-item i {
    color: var(--gray-500);
    margin-top: 3px;
    flex-shrink: 0;
}

.nominatim-autocomplete-item .place-name {
    font-weight: 500;
    color: var(--gray-800);
}

.nominatim-autocomplete-item .place-address {
    font-size: 12px;
    color: var(--gray-600);
    margin-top: 2px;
}

.nominatim-no-results {
    padding: 15px;
    text-align: center;
    color: var(--gray-500);
    font-style: italic;
}

.nominatim-loading {
    padding: 15px;
    text-align: center;
    color: var(--gray-500);
}

.nominatim-loading i {
    animation: spin 1s linear infinite;
}

/* Ensure Leaflet controls don't overlap with custom UI */
.leaflet-top.leaflet-right {
    top: 10px;
    right: 10px;
}

.leaflet-bottom.leaflet-right {
    bottom: 10px;
    right: 10px;
}

/* Fix Leaflet z-index issues with Bootstrap modals */
.leaflet-pane {
    z-index: 400;
}

.leaflet-tile-pane {
    z-index: 200;
}

.leaflet-overlay-pane {
    z-index: 400;
}

.leaflet-shadow-pane {
    z-index: 500;
}

.leaflet-marker-pane {
    z-index: 600;
}

.leaflet-tooltip-pane {
    z-index: 650;
}

.leaflet-popup-pane {
    z-index: 700;
}

.leaflet-control {
    z-index: 800;
}

/* Address search dropdown must be above map controls */
.nominatim-search-dropdown,
#addressSearchDropdown,
.search-results,
#searchResults {
    z-index: 9999 !important;
    position: absolute !important;
    background: white;
}

/* Ensure address search container has proper stacking context */
.address-search {
    position: relative;
    z-index: 1001;
}

/* Task card address search results dropdown */
.address-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 300px;
    overflow-y: auto;
    background-color: #fff;
    border: 1px solid #ddd;
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
}

.address-result-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    transition: background-color 0.15s ease;
}

.address-result-item:last-child {
    border-bottom: none;
}

.address-result-item:hover {
    background-color: #f5f5f5;
}

/* Input group should also be above map */
.address-search .input-group {
    position: relative;
    z-index: 1002;
}

/* Route line styles */
.leaflet-interactive.route-line {
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* Segment colors for multi-segment routes */
.route-segment-0 { stroke: #4285f4; }
.route-segment-1 { stroke: #ea4335; }
.route-segment-2 { stroke: #34a853; }
.route-segment-3 { stroke: #fbbc05; }
.route-segment-4 { stroke: #9c27b0; }
.route-segment-5 { stroke: #00bcd4; }

/* Segment legend color boxes */
.segment-color {
    display: inline-block;
    width: 20px;
    height: 4px;
    margin-right: 8px;
    border-radius: 2px;
    vertical-align: middle;
}


/* Route Statistics */
.route-info {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.route-stat {
    flex: 1;
    background-color: white;
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
}

.route-stat:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.route-stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--primary-color);
    line-height: 1.2;
}

.route-stat-label {
    font-size: 0.875rem;
    color: var(--gray-600);
    margin-top: 0.25rem;
}

/* ==========================================================================
   7. Task Management
   ========================================================================== */
.task-list {
    max-height: 600px;
    overflow-y: auto;
    padding: 0.5rem;
}

.task-item {
    background-color: white;
    border-radius: var(--radius-md);
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-sm);
    padding: 0.75rem;
    margin-bottom: 0.75rem;
    transition: all var(--transition-fast);
    cursor: pointer;
}

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

.task-item.active {
    border-left: 4px solid var(--primary-color);
    background-color: rgba(26, 115, 232, 0.05);
}

.task-number-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
}

.task-detail-card {
    margin-bottom: 1.5rem;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

.task-detail-header {
    background-color: var(--secondary-color);
    color: white;
    padding: 1rem 1.25rem;
}

.task-detail-body {
    padding: 1.25rem;
}

.detail-section {
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: var(--gray-50);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--secondary-color);
}

.detail-label {
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 0.25rem;
}

.detail-content {
    color: var(--gray-600);
    line-height: 1.5;
}

.task-clue {
    background-color: var(--gray-50);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 4px solid var(--warning-color);
    font-style: italic;
}

/* ==========================================================================
   8. Challenge Components
   ========================================================================== */
.challenge-card {
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: white;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    height: 100%;
    cursor: pointer;
}

.challenge-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.challenge-card .card-header {
    background-color: var(--secondary-color);
    color: white;
    padding: 1rem 1.25rem;
    font-weight: 600;
}

.challenge-card .card-body {
    padding: 1.25rem;
}

.challenge-card .card-footer {
    background-color: var(--gray-50);
    padding: 1rem;
    border-top: 1px solid var(--gray-200);
}

.challenge-card.joined {
    border: 2px solid var(--success-color);
}

.challenge-badge {
    display: inline-block;
    padding: 0.35em 0.65em;
    font-size: 0.75em;
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--radius-full);
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* Challenge Logo Styles */
.challenge-logo-wrapper {
    height: 200px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 15px;
    border-bottom: 1px solid var(--gray-200);
}

.challenge-logo {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: var(--radius-md);
    transition: transform var(--transition-normal);
}

.challenge-card:hover .challenge-logo {
    transform: scale(1.05);
}

/* Ensure consistent card heights with logos */
.challenge-card {
    display: flex;
    flex-direction: column;
}

.challenge-card .card-body {
    flex: 1;
}

/* Responsive logo adjustments for mobile */
@media (max-width: 768px) {
    .challenge-logo-wrapper {
        height: 150px;
        padding: 10px;
    }
    
    .challenge-card:hover .challenge-logo {
        transform: scale(1.02);
    }
}

@media (max-width: 480px) {
    .challenge-logo-wrapper {
        height: 120px;
        padding: 8px;
    }
}

/* Challenge details page - larger logo display */
.challenge-logo-detail {
    height: 250px;
}

@media (max-width: 768px) {
    .challenge-logo-detail {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .challenge-logo-detail {
        height: 140px;
    }
}

.challenge-info {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.date-range {
    font-size: 0.85rem;
    color: var(--gray-500);
    margin-bottom: 0.5rem;
}

/* ==========================================================================
   9. Camera & Photo Upload
   ========================================================================== */
/* Modern camera interface for mobile */
.camera-interface {
    position: relative;
    background-color: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    padding: 0;
    margin-bottom: 1rem;
}

.camera-viewfinder {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 100%; /* 1:1 Aspect ratio */
    background-color: #111;
    overflow: hidden;
}

.camera-controls {
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 1rem;
    background-color: #000;
}

.camera-button {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background-color: white;
    border: 3px solid rgba(255, 255, 255, 0.5);
    padding: 0;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0.3);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.3);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.camera-button:before {
    content: '';
    position: absolute;
    top: 4px;
    left: 4px;
    width: calc(100% - 8px);
    height: calc(100% - 8px);
    border-radius: 50%;
    background-color: white;
}

.camera-button:active {
    transform: scale(0.9);
}

.camera-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.camera-switch:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.camera-flash {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.camera-flash:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.camera-flash.active {
    background-color: var(--warning-color);
    color: var(--gray-800);
}

.photo-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.photo-preview img {
    max-width: 100%;
    max-height: 100%;
}

.photo-actions {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
}

.photo-action-button {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    background-color: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.photo-action-button:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.photo-action-button.primary {
    background-color: var(--primary-color);
}

.photo-action-button.primary:hover {
    background-color: var(--primary-hover);
}

.photo-guide {
    position: absolute;
    top: 1rem;
    left: 0;
    width: 100%;
    text-align: center;
    color: white;
    font-weight: 500;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
    z-index: 1;
}

.photo-thumbnails {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
}

.photo-thumbnail {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    object-fit: cover;
    border: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.photo-thumbnail:hover {
    transform: scale(1.05);
    border-color: var(--primary-color);
}

.photo-thumbnail.selected {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px var(--primary-color);
}

/* Upload button that looks like a camera app */
.camera-upload {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: #000;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1rem;
    color: white;
}

.camera-upload-icon {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.camera-upload-button {
    background-color: var(--secondary-color);
    border: none;
    border-radius: var(--radius-full);
    color: white;
    font-weight: 600;
    padding: 0.75rem 2rem;
    margin-top: 1rem;
    transition: all var(--transition-normal);
}

.camera-upload-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Photo gallery for admin view */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.photo-gallery-item {
    position: relative;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.photo-gallery-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.photo-gallery-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
}

.photo-gallery-info {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8) 0%, rgba(0, 0, 0, 0) 100%);
    color: white;
    padding: 1rem;
}

.photo-gallery-user {
    font-weight: 500;
    margin-bottom: 0.25rem;
}

.photo-gallery-date {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* ==========================================================================
   10. Media Queries
   ========================================================================== */
/* Small devices (phones, 576px and up) */
@media (min-width: 576px) {
    .container {
        max-width: 540px;
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
    }
    
    .navbar-expand-md .navbar-nav {
        flex-direction: row;
    }
    
    .navbar-expand-md .navbar-nav .nav-link {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }
    
    .navbar-expand-md .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
    
    .navbar-expand-md .navbar-toggler {
        display: none;
    }
    
    #map {
        height: 60vh;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .container {
        max-width: 960px;
    }
    
    .navbar-expand-lg .navbar-nav {
        flex-direction: row;
    }
    
    .navbar-expand-lg .navbar-nav .nav-link {
        padding-right: 0.75rem;
        padding-left: 0.75rem;
    }
    
    .navbar-expand-lg .navbar-collapse {
        display: flex !important;
        flex-basis: auto;
    }
    
    .navbar-expand-lg .navbar-toggler {
        display: none;
    }
    
    #map {
        height: 500px;
    }
}

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

/* Mobile specific styles */
@media (max-width: 767.98px) {
    body {
        font-size: 14px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .navbar-brand {
        font-size: 1.1rem;
    }
    
    .btn {
        padding: 0.5rem 0.75rem;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .photo-gallery {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
    
    .photo-gallery-image {
        height: 150px;
    }
    
    .add-task-btn {
        position: fixed;
        bottom: 1rem;
        right: 1rem;
        width: 56px;
        height: 56px;
        border-radius: 50%;
        background-color: var(--primary-color);
        color: white;
        box-shadow: var(--shadow-lg);
        display: flex;
        align-items: center;
        justify-content: center;
        border: none;
        font-size: 1.5rem;
        z-index: var(--z-fixed);
    }
    
    .task-actions .btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   11. Utility Classes & Animation
   ========================================================================== */
/* Text */
.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-light { color: var(--light-color) !important; }
.text-dark { color: var(--dark-color) !important; }
.text-muted { color: var(--gray-600) !important; }
.text-white { color: white !important; }

/* Background */
.bg-primary { background-color: var(--primary-color) !important; }
.bg-secondary { background-color: var(--secondary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-info { background-color: var(--info-color) !important; }
.bg-light { background-color: var(--light-color) !important; }
.bg-dark { background-color: var(--dark-color) !important; }
.bg-white { background-color: white !important; }

/* Spacing */
.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mr-0 { margin-right: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.ml-0 { margin-left: 0 !important; }

.m-1 { margin: 0.25rem !important; }
.mt-1 { margin-top: 0.25rem !important; }
.mr-1 { margin-right: 0.25rem !important; }
.mb-1 { margin-bottom: 0.25rem !important; }
.ml-1 { margin-left: 0.25rem !important; }

.m-2 { margin: 0.5rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mr-2 { margin-right: 0.5rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.ml-2 { margin-left: 0.5rem !important; }

.m-3 { margin: 1rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mr-3 { margin-right: 1rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.ml-3 { margin-left: 1rem !important; }

.m-4 { margin: 1.5rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mr-4 { margin-right: 1.5rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.ml-4 { margin-left: 1.5rem !important; }

.m-5 { margin: 3rem !important; }
.mt-5 { margin-top: 3rem !important; }
.mr-5 { margin-right: 3rem !important; }
.mb-5 { margin-bottom: 3rem !important; }
.ml-5 { margin-left: 3rem !important; }

.p-0 { padding: 0 !important; }
.pt-0 { padding-top: 0 !important; }
.pr-0 { padding-right: 0 !important; }
.pb-0 { padding-bottom: 0 !important; }
.pl-0 { padding-left: 0 !important; }

.p-1 { padding: 0.25rem !important; }
.pt-1 { padding-top: 0.25rem !important; }
.pr-1 { padding-right: 0.25rem !important; }
.pb-1 { padding-bottom: 0.25rem !important; }
.pl-1 { padding-left: 0.25rem !important; }

.p-2 { padding: 0.5rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pr-2 { padding-right: 0.5rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pl-2 { padding-left: 0.5rem !important; }

.p-3 { padding: 1rem !important; }
.pt-3 { padding-top: 1rem !important; }
.pr-3 { padding-right: 1rem !important; }
.pb-3 { padding-bottom: 1rem !important; }
.pl-3 { padding-left: 1rem !important; }

.p-4 { padding: 1.5rem !important; }
.pt-4 { padding-top: 1.5rem !important; }
.pr-4 { padding-right: 1.5rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }
.pl-4 { padding-left: 1.5rem !important; }

.p-5 { padding: 3rem !important; }
.pt-5 { padding-top: 3rem !important; }
.pr-5 { padding-right: 3rem !important; }
.pb-5 { padding-bottom: 3rem !important; }
.pl-5 { padding-left: 3rem !important; }

/* Display */
.d-none { display: none !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-grid { display: grid !important; }

/* Flex */
.flex-row { flex-direction: row !important; }
.flex-column { flex-direction: column !important; }
.flex-wrap { flex-wrap: wrap !important; }
.flex-nowrap { flex-wrap: nowrap !important; }
.justify-content-start { justify-content: flex-start !important; }
.justify-content-end { justify-content: flex-end !important; }
.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-around { justify-content: space-around !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-stretch { align-items: stretch !important; }

/* Position */
.position-relative { position: relative !important; }
.position-absolute { position: absolute !important; }
.position-fixed { position: fixed !important; }
.position-sticky { position: sticky !important; }

/* Text alignment */
.text-start { text-align: left !important; }
.text-center { text-align: center !important; }
.text-end { text-align: right !important; }

/* Visibility */
.visible { visibility: visible !important; }
.invisible { visibility: hidden !important; }

/* Overflow */
.overflow-auto { overflow: auto !important; }
.overflow-hidden { overflow: hidden !important; }

/* Border */
.border { border: 1px solid var(--gray-300) !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid var(--gray-300) !important; }
.border-end { border-right: 1px solid var(--gray-300) !important; }
.border-bottom { border-bottom: 1px solid var(--gray-300) !important; }
.border-start { border-left: 1px solid var(--gray-300) !important; }

.border-primary { border-color: var(--primary-color) !important; }
.border-secondary { border-color: var(--secondary-color) !important; }
.border-success { border-color: var(--success-color) !important; }
.border-danger { border-color: var(--danger-color) !important; }
.border-warning { border-color: var(--warning-color) !important; }
.border-info { border-color: var(--info-color) !important; }
.border-light { border-color: var(--light-color) !important; }
.border-dark { border-color: var(--dark-color) !important; }

/* Border radius */
.rounded { border-radius: var(--radius-md) !important; }
.rounded-sm { border-radius: var(--radius-sm) !important; }
.rounded-lg { border-radius: var(--radius-lg) !important; }
.rounded-circle { border-radius: 50% !important; }
.rounded-pill { border-radius: var(--radius-full) !important; }
.rounded-0 { border-radius: 0 !important; }

/* Shadows */
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow-md) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }
.shadow-none { box-shadow: none !important; }

/* Width/height */
.w-25 { width: 25% !important; }
.w-50 { width: 50% !important; }
.w-75 { width: 75% !important; }
.w-100 { width: 100% !important; }
.w-auto { width: auto !important; }

.h-25 { height: 25% !important; }
.h-50 { height: 50% !important; }
.h-75 { height: 75% !important; }
.h-100 { height: 100% !important; }
.h-auto { height: auto !important; }

/* Animation */
@keyframes fadeIn {
   from { opacity: 0; }
   to { opacity: 1; }
}

@keyframes slideInUp {
   from {
       transform: translateY(20px);
       opacity: 0;
   }
   to {
       transform: translateY(0);
       opacity: 1;
   }
}

@keyframes slideInRight {
   from {
       transform: translateX(20px);
       opacity: 0;
   }
   to {
       transform: translateX(0);
       opacity: 1;
   }
}

@keyframes spin {
   from { transform: rotate(0deg); }
   to { transform: rotate(360deg); }
}

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

.animate-fadeIn {
   animation: fadeIn 0.5s ease-in-out;
}

.animate-slideInUp {
   animation: slideInUp 0.5s ease-in-out;
}

.animate-slideInRight {
   animation: slideInRight 0.5s ease-in-out;
}

.animate-spin {
   animation: spin 1s linear infinite;
}

.animate-pulse {
   animation: pulse 2s infinite;
}

/* ==========================================================================
  12. Special States (loading, dark mode, etc.)
  ========================================================================== */
/* Loading States */
.loading-overlay {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: rgba(255, 255, 255, 0.8);
   display: flex;
   flex-direction: column;
   justify-content: center;
   align-items: center;
   z-index: var(--z-modal);
}

.loading-spinner {
   width: 40px;
   height: 40px;
   border: 4px solid rgba(26, 115, 232, 0.3);
   border-radius: 50%;
   border-top-color: var(--primary-color);
   animation: spin 1s linear infinite;
}

.loading-message {
   margin-top: 1rem;
   font-weight: 500;
   color: var(--gray-700);
}

.btn-loading {
   position: relative;
   color: transparent !important;
   pointer-events: none;
}

.btn-loading::after {
   content: "";
   position: absolute;
   width: 1em;
   height: 1em;
   top: calc(50% - 0.5em);
   left: calc(50% - 0.5em);
   border: 2px solid rgba(255, 255, 255, 0.5);
   border-radius: 50%;
   border-top-color: white;
   animation: spin 0.6s linear infinite;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
   :root {
       --light-color: #121212;
       --gray-50: #1e1e1e;
       --gray-100: #2d2d2d;
       --gray-200: #333;
       --gray-300: #444;
       --gray-400: #666;
       --gray-600: #aaa;
       --gray-700: #cfcfcf;
       --gray-800: #f0f0f0;
   }
   
   body {
       color: var(--gray-300);
       background-color: var(--light-color);
   }
   
   .card,
   .modal-content,
   .toast,
   .dropdown-menu {
       background-color: var(--gray-50);
       border-color: var(--gray-300);
   }
   
   .form-control,
   .form-select {
       background-color: var(--gray-100);
       border-color: var(--gray-300);
       color: var(--gray-700);
   }
   
   .form-control:focus,
   .form-select:focus {
       background-color: var(--gray-100);
       border-color: var(--primary-color);
   }
   
   .navbar {
       background-color: var(--gray-50);
   }
   
   .card-header,
   .card-footer,
   .modal-header,
   .modal-footer {
       background-color: var(--gray-100);
       border-color: var(--gray-300);
   }
   
   .btn-light {
       background-color: var(--gray-100);
       border-color: var(--gray-300);
       color: var(--gray-700);
   }
   
   .btn-dark {
       background-color: var(--gray-800);
       border-color: var(--gray-800);
       color: var(--gray-100);
   }
   
   .text-muted {
       color: var(--gray-500) !important;
   }
   
   .border {
       border-color: var(--gray-300) !important;
   }
   
   .bg-light {
       background-color: var(--gray-50) !important;
   }
   
   .loading-overlay {
       background-color: rgba(18, 18, 18, 0.8);
   }
   
   #map {
       border-color: var(--gray-300);
   }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
   *,
   *::before,
   *::after {
       animation-duration: 0.01ms !important;
       animation-iteration-count: 1 !important;
       transition-duration: 0.01ms !important;
       scroll-behavior: auto !important;
   }
   
   .animate-fadeIn,
   .animate-slideInUp,
   .animate-slideInRight,
   .animate-spin,
   .animate-pulse {
       animation: none !important;
   }
   
   .btn:after {
       display: none;
   }
}

/* High contrast mode */
@media (prefers-contrast: more) {
   :root {
       --primary-color: #0052cc;
       --primary-hover: #003d99;
       --secondary-color: #0066ff;
       --success-color: #008800;
       --danger-color: #cc0000;
       --warning-color: #cc6600;
       --info-color: #0066ff;
   }
   
   body {
       color: black;
       background-color: white;
   }
   
   .btn {
       border-width: 2px;
   }
   
   .card,
   .modal-content,
   .toast,
   .navbar,
   .form-control,
   .form-select {
       border-width: 2px;
       border-color: black;
   }
   
   .text-muted {
       color: #555555 !important;
   }
   
   .card-header,
   .card-footer,
   .modal-header,
   .modal-footer {
       background-color: #f0f0f0;
   }
}

/* Print styles */
@media print {
   body {
       background-color: white;
       color: black;
   }
   
   .navbar,
   .admin-nav,
   .btn,
   .loading-overlay,
   .photo-capture-container,
   .camera-interface,
   .add-task-btn {
       display: none !important;
   }
   
   .card {
       break-inside: avoid;
       border: 1px solid #ddd;
       border-radius: 0;
       box-shadow: none;
   }
   
   .container {
       max-width: 100%;
       padding: 0;
   }
   
   a {
       text-decoration: none;
       color: black;
   }
   
   .task-item,
   .challenge-card {
       break-inside: avoid;
       page-break-inside: avoid;
   }
   
   .card-header,
   .card-footer {
       background-color: #f9f9f9 !important;
       color: black !important;
   }
   
   .text-white {
       color: black !important;
   }
   
   #map {
       height: 300px !important;
   }
}

/* Camera & Photo Upload Styles */
.photo-capture-container {
   border: 2px solid var(--gray-300);
   border-radius: var(--radius-lg);
   padding: 1.25rem;
   background-color: var(--gray-50);
   transition: all 0.3s ease;
   margin-bottom: 1rem;
   position: relative;
}

.camera-capture-area {
   position: relative;
/*   min-height: 280px; */
   border-radius: var(--radius-md);
   overflow: hidden;
   background-color: #222;
}

.camera-button-area {
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
/*   padding: 1.5rem; */
   min-height: 280px;
   position: relative;
}

/* Video element styling */
.camera-button-area video {
   width: 100% !important;
   max-height: 70vh;
   object-fit: cover;
   border-radius: 8px;
   margin-bottom: 0.5rem;
}

/* Camera shutter button */
.camera-shutter {
   position: relative;
   width: 70px;
   height: 70px;
   border-radius: 50%;
   background: white;
   border: 3px solid rgba(255, 255, 255, 0.5);
   padding: 0;
   margin: 0;
   box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
   animation: pulse 2s infinite;
   z-index: 10;
   cursor: pointer;
   flex-shrink: 0;
}

.camera-main-controls {
   position: absolute;
   bottom: 20px;
   left: 0;
   width: 100%;
   display: flex;
   justify-content: center;
   padding: 0;
   z-index: 10;
}

.camera-shutter::before {
   content: '';
   position: absolute;
   top: 5px;
   left: 5px;
   width: calc(100% - 10px);
   height: calc(100% - 10px);
   border-radius: 50%;
   background-color: white;
}

/* Cancel button */
.camera-cancel {
   position: absolute;
   bottom: 35px;
   right: 20px;
   background: rgba(0, 0, 0, 0.5);
   border: none;
   color: white;
   font-size: 0.9rem;
   padding: 8px 15px;
   border-radius: 20px;
   margin: 0;
   z-index: 10;
   cursor: pointer;
}

.camera-cancel:hover {
   background: rgba(0, 0, 0, 0.7);
}

/* Camera button when not active */
.camera-btn {
   min-height: 54px;
   font-size: 1rem;
   border-radius: 12px;
   background-color: var(--secondary-color);
   border: none;
   color: white;
   font-weight: 500;
   box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
   transition: all 0.2s ease;
   width: unset !important;
   max-width: 100% !important;
}

/* Camera controls */
.camera-switch-container {
   position: absolute;
   top: 15px;
   right: 15px;
   z-index: 10;
   display: flex;
   align-items: center;
   justify-content: center;
}

.camera-switch-btn {
   width: 40px;
   height: 40px;
   border-radius: 50%;
   background-color: rgba(0, 0, 0, 0.5);
   color: white;
   border: none;
   display: flex;
   align-items: center;
   justify-content: center;
   box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
   cursor: pointer;
}

.camera-switch-btn:hover {
   background-color: rgba(0, 0, 0, 0.7);
}

.camera-switch-btn i {
   font-size: 1.2rem;
}

/* Photo preview */
.camera-preview {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: #000;
   z-index: 2;
   display: flex;
   align-items: center;
   justify-content: center;
}

.captured-image {
   max-width: 100%;
   max-height: 70vh;
   object-fit: contain;
   border-radius: 8px;
   box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.retake-btn {
   position: absolute;
   bottom: 20px;
   background-color: rgba(0, 0, 0, 0.6);
   color: white;
   border: none;
   width: 50px;
   height: 50px;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
   z-index: 3;
   cursor: pointer;
}

.retake-btn:hover {
   background-color: rgba(0, 0, 0, 0.7);
}

.retake-btn i {
   font-size: 1.2rem;
}

/* Loading state */
.camera-loading {
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   min-height: 280px;
   color: white;
}

.camera-loading .spinner-border {
   margin-bottom: 1rem;
}

/* Has photo state */
.has-photo {
   border-color: var(--success-color);
   background: rgba(52, 168, 83, 0.05);
}

/* iOS-specific camera styles */
body.camera-active {
   position: fixed;
   width: 100%;
   height: 100%;
   overflow: hidden;
}

body.camera-active .camera-capture-area {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   z-index: 9999;
   border-radius: 0;
   margin: 0;
}

body.camera-active .camera-button-area {
   min-height: 100vh;
}

body.camera-active video {
   height: 100vh !important;
   max-height: none;
}

/* Make retake button more visible */
.retake-btn {
   position: absolute;
   bottom: 20px;
   left: 50%;
   transform: translateX(-50%);
   background-color: rgba(0, 0, 0, 0.6);
   color: white;
   border: none;
   width: 50px;
   height: 50px;
   border-radius: 50%;
   display: flex;
   align-items: center;
   justify-content: center;
   box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
   z-index: 3;
   cursor: pointer;
}

.retake-btn:hover {
   background-color: rgba(0, 0, 0, 0.8);
}

/* Loading state for submit button */
.btn.loading {
   position: relative;
   color: transparent !important;
   pointer-events: none;
}

.btn.loading::after {
   content: "";
   position: absolute;
   width: 20px;
   height: 20px;
   top: 50%;
   left: 50%;
   margin-left: -10px;
   margin-top: -10px;
   border: 2px solid #ffffff;
   border-radius: 50%;
   border-top-color: transparent;
   animation: spin 1s linear infinite;
}

.fas {
   padding-right: 5px;
}

/* Remove icon padding inside circular/icon-only buttons */
.fcm-close-btn .fas,
.fcm-switch-btn .fas,
.fcm-shutter .fas,
.retake-btn .fas,
.camera-switch-btn .fas {
   padding-right: 0;
}

.task-card:not(.expanded) .card-body {
   display: none;
}

.task-card.expanded .collapse-indicator {
   transform: rotate(180deg);
}

/* Proper photo preview sizing */
.captured-image {
   max-width: 100%;
   max-height: 70vh;
   object-fit: contain;
   display: block;
   margin: 0 auto;
   border-radius: 8px;
}

/* Prevent aspect ratio distortion in camera capture */
.camera-capture-area video {
   width: 100%;
   max-height: 70vh;
   object-fit: cover;
}

/* Maintain aspect ratio for photo canvas */
#photoCanvas {
   display: none;
   max-width: 100%;
}

/* ============================================================
   FULLSCREEN CAMERA MODAL
   ============================================================ */
body.camera-modal-open {
   overflow: hidden !important;
   position: fixed;
   width: 100%;
   height: 100%;
}

.fullscreen-camera-modal {
   position: fixed;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background-color: #000;
   z-index: 10000;
   display: flex;
   flex-direction: column;
}

.fcm-header {
   display: flex;
   justify-content: space-between;
   align-items: center;
   padding: 12px 16px;
   padding-top: max(12px, env(safe-area-inset-top));
   background: rgba(0, 0, 0, 0.6);
   position: absolute;
   top: 0;
   left: 0;
   right: 0;
   z-index: 10;
}

.fcm-title {
   color: white;
   font-size: 1rem;
   font-weight: 600;
}

.fcm-close-btn {
   width: 36px;
   height: 36px;
   border-radius: 50%;
   background: rgba(255, 255, 255, 0.2);
   color: white;
   border: none;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1.1rem;
   cursor: pointer;
}

.fcm-close-btn:hover {
   background: rgba(255, 255, 255, 0.35);
}

.fcm-viewfinder {
   flex: 1;
   display: flex;
   align-items: center;
   justify-content: center;
   overflow: hidden;
   position: relative;
}

.fcm-viewfinder video {
   width: 100%;
   height: 100%;
   object-fit: cover;
}

.fcm-controls {
   display: flex;
   justify-content: center;
   padding: 20px 16px;
   padding-bottom: max(20px, env(safe-area-inset-bottom));
   background: rgba(0, 0, 0, 0.6);
   position: absolute;
   bottom: 0;
   left: 0;
   right: 0;
   z-index: 10;
}

.fcm-controls-row {
   display: flex;
   align-items: center;
   justify-content: center;
   width: 100%;
   position: relative;
}

.fcm-shutter {
   width: 72px;
   height: 72px;
   border-radius: 50%;
   background: white;
   border: 4px solid rgba(255, 255, 255, 0.4);
   padding: 0;
   cursor: pointer;
   position: relative;
   box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
   animation: pulse 2s infinite;
   flex-shrink: 0;
}

.fcm-shutter::before {
   content: '';
   position: absolute;
   top: 5px;
   left: 5px;
   width: calc(100% - 10px);
   height: calc(100% - 10px);
   border-radius: 50%;
   background: white;
}

.fcm-shutter:active {
   transform: scale(0.9);
}

.fcm-cancel-btn {
   background: none;
   border: none;
   color: white;
   font-size: 1rem;
   padding: 8px 4px;
   cursor: pointer;
   position: absolute;
   left: 20px;
}

.fcm-cancel-btn:hover {
   opacity: 0.8;
}

.fcm-switch-btn {
   width: 44px;
   height: 44px;
   border-radius: 50%;
   background: rgba(255, 255, 255, 0.2);
   color: white;
   border: none;
   display: flex;
   align-items: center;
   justify-content: center;
   font-size: 1.2rem;
   cursor: pointer;
   position: absolute;
   right: 20px;
}

.fcm-switch-btn:hover {
   background: rgba(255, 255, 255, 0.35);
}

/* Review screen inside modal */
.fcm-review {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   background: #000;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   z-index: 20;
}

.fcm-review img {
   max-width: 100%;
   max-height: 70vh;
   object-fit: contain;
   border-radius: 8px;
}

.fcm-review-controls {
   display: flex;
   gap: 20px;
   margin-top: 24px;
   padding: 0 16px;
   padding-bottom: max(16px, env(safe-area-inset-bottom));
}

.fcm-review-controls .btn {
   min-width: 130px;
   font-size: 1rem;
}

/* Loading state */
.fcm-loading {
   position: absolute;
   top: 0;
   left: 0;
   width: 100%;
   height: 100%;
   display: flex;
   flex-direction: column;
   align-items: center;
   justify-content: center;
   gap: 16px;
   color: white;
   z-index: 5;
}

/* Thumbnail preview in inline card */
.photo-thumbnail-preview {
   position: relative;
   width: 100%;
   min-height: 200px;
   background-color: #000;
   border-radius: var(--radius-md);
   overflow: hidden;
   display: flex;
   align-items: center;
   justify-content: center;
}

.photo-thumbnail-preview .captured-image {
   max-width: 100%;
   max-height: 70vh;
   object-fit: contain;
   display: block;
   margin: 0 auto;
   border-radius: 8px;
}

.photo-thumbnail-preview .retake-btn {
   position: absolute;
   bottom: 12px;
   left: 50%;
   transform: translateX(-50%);
}

/* Screen reader only text */
.sr-only {
   position: absolute;
   width: 1px;
   height: 1px;
   padding: 0;
   margin: -1px;
   overflow: hidden;
   clip: rect(0, 0, 0, 0);
   white-space: nowrap;
   border: 0;
}

/* Mobile tweaks for camera modal */
@media screen and (max-height: 600px) {
   .fcm-review img {
       max-height: 55vh;
   }
   .fcm-controls {
       padding: 12px 16px;
   }
}
/* Switch camera button improvements for Android */
.camera-switch-container {
   position: absolute;
   top: 15px;
   right: 15px;
   z-index: 100;
   display: flex;
   align-items: center;
   justify-content: center;
}

/* Ensure captured images display properly */
.camera-preview {
   width: 100%;
   position: relative;
   background-color: #000;
   min-height: 280px;
   display: flex;
   align-items: center;
   justify-content: center;
   border-radius: 8px;
   overflow: hidden;
}

/* Maintain consistent dimensions between preview and capture */
.camera-capture-area video {
   width: 100%;
   max-height: 70vh;
   object-fit: cover;
   border-radius: 8px;
}

/* iPhone-specific media queries */
@media screen and (max-width: 414px) {
   .ios-controls {
       bottom: 120px;
   }
   .ios-cancel {
       bottom: 140px;
   }
   .ios-camera-interface video {
       max-height: 50vh;
   }
}

@media screen and (max-width: 375px) {
   .ios-controls {
       bottom: 100px;
   }
   .ios-cancel {
       bottom: 120px;
   }
   .ios-camera-interface video {
       max-height: 45vh;
   }
}

@media screen and (max-height: 700px) {
   .ios-camera-interface video {
       max-height: 50vh;
   }
   .ios-controls {
       bottom: 80px;
   }
   .ios-cancel {
       bottom: 100px;
   }
}

@media screen and (max-height: 600px) {
   .ios-camera-interface video {
       max-height: 45vh;
   }
   .ios-controls {
       bottom: 60px;
   }
   .ios-cancel {
       bottom: 80px;
   }
}

/* Smart text color detection - Light text on dark backgrounds, dark text on light backgrounds */
/* We'll use JavaScript to apply this dynamically, but set defaults here */

/* For club branding headers and elements with secondary color backgrounds */
.secondary-bg-smart-text {
   color: white; /* Default to white, will be overridden by JavaScript */
}

/* Dynamic text color class that will be applied via JavaScript */
.dynamic-text-light {
   color: white !important;
}

.dynamic-text-dark {
   color: #333 !important;
}

/* Apply smart text colors to specific elements */
.card-header[style*="background-color"],
.modal-header[style*="background-color"],
.task-detail-header[style*="background-color"],
.challenge-card .card-header[style*="background-color"] {
   color: white; /* Default, will be updated by JavaScript */
}

/* ==========================================================================
   13. Mobile App Styling
   ========================================================================== */

/* Mobile App Cards */
.app-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    margin-bottom: 16px;
    transition: transform 0.2s;
}

.app-card:active {
    transform: scale(0.98);
}

.app-card .card-header {
    background: white;
    border-bottom: 1px solid var(--gray-200);
    padding: 16px;
}

/* App Button Styles */
.btn-app {
    border-radius: 50px;
    padding: 12px 24px;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-app.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-app.btn-lg {
    padding: 14px 28px;
    font-size: 1.125rem;
}

/* Mobile App Avatar */
.avatar-circle {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

/* Section Title for Mobile */
.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Stats Cards Horizontal Scroll */
.stats-scroll {
    display: flex;
    overflow-x: auto;
    padding: 8px 0;
    margin: 0 -8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; /* Firefox */
}

.stats-scroll::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Edge */
}

.stats-card {
    flex: 0 0 auto;
    width: 120px;
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin: 0 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
}

.stats-card-admin {
    flex: 0 0 auto;
    background: white;
    border-radius: 16px;
    padding: 16px;
    margin: 0 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    text-align: center;
}
.stats-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 12px;
    font-size: 1.25rem;
}

.bg-primary-light { background-color: rgba(26, 115, 232, 0.1); }
.bg-success-light { background-color: rgba(52, 168, 83, 0.1); }
.bg-info-light { background-color: rgba(66, 133, 244, 0.1); }
.bg-warning-light { background-color: rgba(251, 188, 5, 0.1); }

.stats-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 4px;
}

.stats-label {
    font-size: 0.75rem;
    color: var(--gray-600);
}

/* Task Card Mobile Styling */
.task-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 16px;
    border: none;
    transition: transform 0.2s;
    overflow: hidden;
}

.task-card:active {
    transform: scale(0.98);
}

.task-card-header {
    padding: 16px;
    background-color: rgba(26, 115, 232, 0.05);
    border-bottom: 1px solid rgba(26, 115, 232, 0.1);
}

/* Challenge Cards for Mobile */
.challenge-card-app {
    background: white;
    border-radius: 16px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    margin-bottom: 16px;
    border: none;
}

/* Mobile Challenge Hero Header */
.challenge-hero-header {
    margin: -16px -16px 20px;
    border-radius: 0 0 24px 24px;
    overflow: hidden;
}

.challenge-hero-content {
    padding-top: 60px;
    padding-bottom: 30px;
}

/* Empty State for Mobile App */
.empty-state {
    background: white;
    border-radius: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    padding: 32px 16px;
    text-align: center;
}

.empty-icon {
    font-size: 3rem;
    color: var(--gray-400);
    margin-bottom: 16px;
}

/* Floating Action Button (FAB) */
.fab {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    z-index: 1020;
    font-size: 1.5rem;
    border: none;
}

.fab:active {
    transform: scale(0.95);
}

/* Modern Camera Capture */
.camera-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #000;
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.camera-toolbar {
    padding: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.camera-preview-area {
    flex: 1;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.camera-shutter-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background-color: white;
    border: 4px solid rgba(255,255,255,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.camera-action-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255,255,255,0.2);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Make bottom nav disappear when keyboard is shown */
@media (max-height: 400px) {
    .mobile-nav {
        display: none !important;
    }
    
    body {
        padding-bottom: 0 !important;
    }
    
    .legal-footer {
        display: none !important;
    }
}

/* Badges for Mobile App */
.badge-app {
    padding: 6px 12px;
    border-radius: 50px;
    font-weight: 500;
    font-size: 0.875rem;
}

/* Pull-to-refresh indicator styling */
.pull-to-refresh {
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
}

.pull-to-refresh i {
    animation: spin 1.5s linear infinite;
}

/* Challenge tag styling */
.challenge-tag {
    display: inline-flex;
    align-items: center;
    background-color: var(--gray-100);
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    color: var(--gray-700);
}