/* ================================================
   DESIGN SYSTEM - CSS VARIABLES
   ================================================ */

:root {
    /* Color Palette - WCAG AA Compliant */
    --primary-green: #2d5016;
    --secondary-green: #4a7c59;
    --light-green: #8fbc8f;
    --accent-green: #6a9f3d; /* Adjusted for better contrast */
    --dark-green: #1b2f0e;
    --success-green: #2e7d32; /* Darker for better contrast */
    --hover-green: #388e3c;
    --background-light: #f8f9f8;
    --text-dark: #1a1a1a; /* Darker for better contrast */
    --text-medium: #4a4a4a; /* Added for medium emphasis */
    --text-light: #666666;
    --border-color: #d0d0d0; /* Slightly darker for visibility */
    --white: #ffffff;
    --shadow: rgba(45, 80, 22, 0.1);
    --shadow-md: rgba(45, 80, 22, 0.15);
    --shadow-lg: rgba(45, 80, 22, 0.2);

    /* Error and Warning Colors - WCAG AA Compliant */
    --error-red: #c62828; /* AA compliant */
    --error-bg: #fdecea;
    --warning-orange: #e65100;
    --warning-bg: #fff3e0;
    --info-blue: #1565c0;
    --info-bg: #e3f2fd;

    /* Spacing System */
    --spacing-xs: 0.25rem;   /* 4px */
    --spacing-sm: 0.5rem;    /* 8px */
    --spacing-md: 1rem;      /* 16px */
    --spacing-lg: 1.5rem;    /* 24px */
    --spacing-xl: 2rem;      /* 32px */
    --spacing-xxl: 3rem;     /* 48px */

    /* Typography Scale */
    --font-size-xs: 0.75rem;    /* 12px */
    --font-size-sm: 0.875rem;   /* 14px */
    --font-size-base: 1rem;     /* 16px */
    --font-size-lg: 1.125rem;   /* 18px */
    --font-size-xl: 1.25rem;    /* 20px */
    --font-size-2xl: 1.5rem;    /* 24px */
    --font-size-3xl: 1.875rem;  /* 30px */
    --font-size-4xl: 2.25rem;   /* 36px */

    /* Line Heights */
    --line-height-tight: 1.25;
    --line-height-normal: 1.5;
    --line-height-relaxed: 1.75;

    /* Font Weights */
    --font-weight-normal: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 8px;
    --radius-xl: 12px;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms ease-in-out;
    --transition-base: 200ms ease-in-out;
    --transition-slow: 300ms ease-in-out;

    /* Z-index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;

    /* Touch Target Sizes */
    --touch-target-min: 44px;

    /* Focus Ring */
    --focus-ring-width: 3px;
    --focus-ring-offset: 2px;
    --focus-ring-color: var(--accent-green);
    --focus-ring-opacity: 0.5;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: var(--font-size-base);
    line-height: var(--line-height-normal);
    background-color: var(--background-light);
    color: var(--text-dark);
    font-weight: var(--font-weight-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ================================================
   FOCUS INDICATORS - WCAG 2.1 AA Compliant
   ================================================ */

/* Remove default outline and add custom focus ring */
*:focus {
    outline: none;
}

/* Universal focus visible indicator */
*:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
    box-shadow: 0 0 0 var(--focus-ring-offset) var(--white),
                0 0 0 calc(var(--focus-ring-width) + var(--focus-ring-offset)) var(--focus-ring-color);
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -100px;
    left: var(--spacing-sm);
    background: var(--primary-green);
    color: var(--white);
    padding: var(--spacing-md);
    text-decoration: none;
    border-radius: var(--radius-md);
    z-index: var(--z-tooltip);
    font-weight: var(--font-weight-semibold);
    transition: top var(--transition-base);
}

.skip-to-main:focus,
.skip-to-main:focus-visible {
    top: var(--spacing-sm);
    outline: var(--focus-ring-width) solid var(--accent-green);
    outline-offset: var(--focus-ring-offset);
}

/* Header */
.header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
    color: var(--white);
    padding: 1rem 0;
    box-shadow: 0 2px 10px var(--shadow);
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--white);
    text-decoration: none;
}

.organization-info {
    text-align: right;
}

.organization-info h2 {
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.organization-info p {
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Logout Button */
.logout-container {
    display: flex;
    align-items: center;
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    text-decoration: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
}

/* Navigation */
.nav {
    background-color: var(--white);
    border-bottom: 3px solid var(--accent-green);
    box-shadow: 0 2px 5px var(--shadow);
}

.nav-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2rem;
}

.nav-tabs {
    display: flex;
    list-style: none;
}

.nav-tab {
    margin-right: 2rem;
}

.nav-tab a {
    display: block;
    padding: 1rem 1.5rem;
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
}

.nav-tab a:hover,
.nav-tab a.active {
    color: var(--primary-green);
    border-bottom-color: var(--accent-green);
    background-color: var(--background-light);
}

/* Main Content */
.main {
    max-width: 1200px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.page-title {
    color: var(--primary-green);
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--light-green);
    padding-bottom: 0.5rem;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 8px;
    box-shadow: 0 4px 15px var(--shadow);
    margin-bottom: 1.5rem;
    overflow: hidden;
    border-left: 4px solid var(--accent-green);
}

.card-header {
    background: linear-gradient(135deg, var(--light-green) 0%, var(--accent-green) 100%);
    color: var(--white);
    padding: 1rem 1.5rem;
    font-weight: bold;
    font-size: 1.1rem;
}

.card-body {
    padding: 1.5rem;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Dashboard Metrics */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.metric-card {
    background: var(--white);
    padding: 1.5rem;
    border-radius: 8px;
    text-align: center;
    box-shadow: 0 2px 10px var(--shadow);
    border-top: 4px solid var(--accent-green);
}

.metric-value {
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary-green);
    margin-bottom: 0.5rem;
}

.metric-label {
    color: var(--text-light);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ================================================
   BUTTONS - Touch-friendly with micro-interactions
   ================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    min-height: var(--touch-target-min);
    min-width: var(--touch-target-min);
    padding: var(--spacing-sm) var(--spacing-lg);
    background: var(--accent-green);
    color: var(--white);
    text-decoration: none;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-size-base);
    font-weight: var(--font-weight-semibold);
    line-height: var(--line-height-tight);
    text-align: center;
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    will-change: transform, box-shadow;
}

/* Button hover state */
.btn:hover:not(:disabled) {
    background: var(--hover-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px var(--shadow-md);
}

/* Button active/pressed state - ripple effect */
.btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px var(--shadow);
}

/* Button focus state */
.btn:focus-visible {
    outline: var(--focus-ring-width) solid var(--focus-ring-color);
    outline-offset: var(--focus-ring-offset);
}

/* Button disabled state */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Button variants */
.btn-primary {
    background: var(--primary-green);
    border-color: var(--primary-green);
}

.btn-primary:hover:not(:disabled) {
    background: var(--dark-green);
    border-color: var(--dark-green);
}

.btn-secondary {
    background: var(--secondary-green);
    border-color: var(--secondary-green);
    color: var(--white);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--primary-green);
    border-color: var(--primary-green);
}

/* Button loading state */
.btn[aria-busy="true"] {
    opacity: 0.7;
    cursor: wait;
    pointer-events: none;
}

/* Ripple effect container */
.btn::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::after {
    width: 300px;
    height: 300px;
}

/* ================================================
   FORMS - Touch-friendly and accessible
   ================================================ */

.form-group {
    margin-bottom: var(--spacing-lg);
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: var(--spacing-sm);
    color: var(--text-dark);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-sm);
    line-height: var(--line-height-normal);
}

.form-input,
.form-select {
    width: 100%;
    min-height: var(--touch-target-min);
    padding: var(--spacing-sm) var(--spacing-md);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    font-family: inherit;
    line-height: var(--line-height-normal);
    color: var(--text-dark);
    background-color: var(--white);
    transition: all var(--transition-base);
    appearance: none;
}

/* Form input focus state */
.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(106, 159, 61, 0.15);
}

/* Form input hover state */
.form-input:hover:not(:disabled):not(:focus),
.form-select:hover:not(:disabled):not(:focus) {
    border-color: var(--accent-green);
}

/* Form input error state */
.form-input[aria-invalid="true"],
.form-select[aria-invalid="true"] {
    border-color: var(--error-red);
    background-color: var(--error-bg);
}

/* Form input success state */
.form-input[aria-invalid="false"]:valid,
.form-select[aria-invalid="false"]:valid {
    border-color: var(--success-green);
}

/* Form input disabled state */
.form-input:disabled,
.form-select:disabled {
    background-color: var(--background-light);
    color: var(--text-light);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Error message styling */
.error-message,
.field-error {
    display: flex;
    align-items: flex-start;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
    color: var(--error-red);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 15px var(--shadow);
}

.table th {
    background: var(--primary-green);
    color: var(--white);
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: var(--background-light);
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-enabled {
    background: var(--success-green);
    color: var(--white);
}

.status-disabled {
    background: var(--text-light);
    color: var(--white);
}

/* Feature list */
.feature-list {
    list-style: none;
}

.feature-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.feature-item:last-child {
    border-bottom: none;
}

.feature-name {
    font-weight: 500;
    color: var(--text-dark);
}

/* Enhanced Responsive Design */
@media (max-width: 1200px) {
    .header-content {
        flex-wrap: wrap;
        gap: 1rem;
    }

    .user-info {
        min-width: 180px;
    }

    .nav-content {
        flex-wrap: wrap;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 0 1rem;
    }

    .organization-info {
        order: 1;
    }

    .user-info {
        order: 2;
        min-width: auto;
        margin-right: 0;
    }

    .logout-container {
        order: 3;
    }

    .nav-tabs {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
    }

    .nav-tab {
        margin: 0;
        flex: 1;
        min-width: 120px;
        text-align: center;
    }

    .nav-tab a {
        padding: 0.75rem 0.5rem;
        font-size: 0.9rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.25rem;
    }

    .nav-tab svg {
        width: 14px;
        height: 14px;
    }

    .main {
        padding: 0 1rem;
        margin: 1rem auto;
    }

    .page-title {
        font-size: 1.5rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 0.75rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .table {
        font-size: 0.9rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    .btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
    }

    .form-input {
        padding: 0.75rem;
        font-size: 1rem;
    }

    /* Auth container mobile optimizations */
    .auth-container {
        margin: 0.5rem;
        width: calc(100% - 1rem);
    }

    .auth-header {
        padding: 1.5rem;
    }

    .auth-header h1 {
        font-size: 1.5rem;
    }

    .auth-body {
        padding: 1.5rem;
    }

    /* Alert responsiveness */
    .alert-floating {
        right: 10px;
        left: 10px;
        min-width: auto;
        top: 10px;
    }

    /* Feature list mobile */
    .feature-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: 0 0.5rem;
    }

    .nav-content {
        padding: 0 0.5rem;
    }

    .main {
        padding: 0 0.5rem;
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }

    .metric-card {
        padding: 0.75rem;
    }

    .metric-value {
        font-size: 1.25rem;
    }

    .metric-label {
        font-size: 0.8rem;
    }

    .card-body {
        padding: 1rem;
    }

    .btn {
        padding: 0.75rem;
        font-size: 0.85rem;
    }

    .nav-tab a {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }

    .nav-tab span {
        display: none;
    }

    .auth-container {
        margin: 0.25rem;
        width: calc(100% - 0.5rem);
    }
}

/* Loading states */
.loading {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

/* Alerts */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background: #e8f5e8;
    border-color: var(--success-green);
    color: var(--dark-green);
}

.alert-error {
    background: #ffeaea;
    border-color: #f44336;
    color: #c62828;
}

.alert-info {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

/* Chart container */
.chart-container {
    position: relative;
    height: 300px;
    margin: 1rem 0;
}

/* Compact pie chart card */
.pie-chart-card .card-body {
    padding: 0.75rem 1.5rem;
}

.pie-chart-card .card-header {
    padding: 0.75rem 1.5rem;
}

/* Enhanced Authentication Styles */

/* Field Error Styling */
.field-error {
    color: #c62828;
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.field-error::before {
    content: "⚠";
    font-size: 0.9rem;
}

/* Input Focus States */
.form-input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.1);
    transition: all 0.2s ease;
}

.form-input.error {
    border-color: #f44336;
    box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.1);
}

.form-input.success {
    border-color: var(--success-green);
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

/* Password Strength Indicator */
.password-strength {
    margin-top: 0.5rem;
}

.strength-bars {
    display: flex;
    gap: 2px;
    margin-bottom: 0.5rem;
}

.strength-bar {
    flex: 1;
    height: 4px;
    background: #e0e0e0;
    border-radius: 2px;
    transition: background-color 0.3s ease;
}

.strength-text {
    font-size: 0.8rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.strength-requirements {
    font-size: 0.8rem;
}

.strength-requirements div {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    transition: color 0.3s ease;
}

.strength-requirements div:last-child {
    margin-bottom: 0;
}

/* Enhanced Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(2px);
}

.loading-content {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
    max-width: 300px;
    width: 90%;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--border-color);
    border-top: 4px solid var(--accent-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1rem;
}

.loading-text {
    margin: 0;
    color: var(--text-dark);
    font-weight: 500;
}

/* Enhanced Button States */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn.loading {
    position: relative;
    color: transparent;
}

.btn.loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid transparent;
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Alert Messages */
.alert {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border-left: 4px solid;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: relative;
}

.alert::before {
    content: "";
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-top: 2px;
}

.alert-success {
    background: #e8f5e8;
    border-color: var(--success-green);
    color: var(--dark-green);
}

.alert-success::before {
    background: var(--success-green);
    content: "✓";
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.alert-error {
    background: #ffeaea;
    border-color: #f44336;
    color: #c62828;
}

.alert-error::before {
    background: #f44336;
    content: "⚠";
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

.alert-info {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.alert-info::before {
    background: #2196f3;
    content: "i";
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
    font-weight: bold;
}

.alert-warning {
    background: #fff8e1;
    border-color: #ff9800;
    color: #e65100;
}

.alert-warning::before {
    background: #ff9800;
    content: "⚠";
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 0.8rem;
}

/* Floating Alert Messages */
.alert-floating {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    min-width: 300px;
    max-width: 500px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
}

.alert-close {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    margin-left: auto;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert-close:hover {
    opacity: 1;
}

/* Authentication Container Enhancements */
.auth-container {
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    max-width: 500px;
    width: 90%;
    animation: fadeInUp 0.5s ease-out;
}

.auth-header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
    color: white;
    padding: 2rem;
    text-align: center;
}

.auth-header h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 700;
}

.auth-header p {
    margin: 0.5rem 0 0 0;
    opacity: 0.9;
    font-size: 1rem;
}

.auth-body {
    padding: 2rem;
}

.auth-footer {
    background: var(--background-light);
    padding: 1rem;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

/* Form Enhancements */
.form-group {
    margin-bottom: 1.5rem;
    position: relative;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-dark);
    font-weight: 500;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.2s ease;
    background-color: white !important;
}

.form-input::placeholder {
    color: #999;
    opacity: 1;
}

/* Select Enhancement */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='m6 8 4 4 4-4'/%3e%3c/svg%3e");
    background-position: right 0.5rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    appearance: none;
}

/* Animations */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Responsive Authentication */
@media (max-width: 768px) {
    .auth-container {
        width: 95%;
        margin: 1rem;
    }

    .auth-header {
        padding: 1.5rem;
    }

    .auth-header h1 {
        font-size: 1.5rem;
    }

    .auth-body {
        padding: 1.5rem;
    }

    .alert-floating {
        right: 10px;
        left: 10px;
        min-width: auto;
    }
}

/* Dark Mode Support (if needed) */
@media (prefers-color-scheme: dark) {
    .auth-container {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .form-input {
        background-color: white !important;
        border-color: #404040;
        color: #333;
    }

    .form-input::placeholder {
        color: #888;
    }

    .loading-content {
        background: #1a1a1a;
        color: #e0e0e0;
    }
}

/* Accessibility Enhancements */
/* Focus States */
*:focus {
    outline: 3px solid var(--accent-green);
    outline-offset: 2px;
}

.btn:focus,
.form-input:focus,
.nav-tab a:focus {
    outline: 3px solid var(--accent-green);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(124, 179, 66, 0.2);
}

/* Skip to main content link */
.skip-to-main {
    position: absolute;
    top: -40px;
    left: 6px;
    background: var(--primary-green);
    color: white;
    padding: 8px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 100;
    transition: top 0.3s ease;
}

.skip-to-main:focus {
    top: 6px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-green: #1a3d0a;
        --secondary-green: #2d5016;
        --light-green: #4a7c59;
        --accent-green: #5a8f42;
        --text-dark: #000000;
        --text-light: #333333;
        --border-color: #666666;
        --shadow: rgba(0, 0, 0, 0.5);
    }

    .btn {
        border: 2px solid currentColor;
    }

    .card {
        border: 2px solid var(--border-color);
    }

    .metric-card {
        border: 2px solid var(--border-color);
    }
}

/* Reduced motion support */
@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;
    }

    .loading-spinner {
        animation: none;
    }

    .btn:hover {
        transform: none;
    }

    .metric-card:hover {
        transform: none;
    }
}

/* 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;
}

/* Enhanced color contrast */
.text-high-contrast {
    color: var(--text-dark);
    font-weight: 600;
}

/* ARIA live regions */
.live-region {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Enhanced button states */
.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn:disabled:hover {
    transform: none;
    box-shadow: none;
}

.btn[aria-pressed="true"] {
    background-color: var(--dark-green);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Form accessibility */
.form-input:invalid {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.1);
}

.form-input:valid {
    border-color: var(--success-green);
}

.form-input[aria-invalid="true"] {
    border-color: #dc3545;
}

.form-input[aria-invalid="false"] {
    border-color: var(--success-green);
}

/* Required field indicators */
.required::after {
    content: " *";
    color: #dc3545;
    font-weight: bold;
}

/* Error messages */
.error-message {
    color: #dc3545;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.error-message::before {
    content: "⚠";
    font-size: 1rem;
}

/* Success messages */
.success-message {
    color: var(--success-green);
    font-size: 0.875rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.success-message::before {
    content: "✓";
    font-size: 1rem;
}

/* Keyboard navigation indicators */
.keyboard-user *:focus {
    outline: 3px solid var(--accent-green);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .header,
    .nav,
    .logout-btn,
    .btn,
    .loading-overlay {
        display: none !important;
    }

    .main {
        margin: 0;
        padding: 0;
        max-width: none;
    }

    .card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #000;
    }

    .page-title {
        color: #000;
    }

    .metric-value,
    .text-dark {
        color: #000 !important;
    }

    .background-light {
        background: #fff !important;
    }
}

/* Dark mode improvements */
@media (prefers-color-scheme: dark) {
    .auth-container,
    .card,
    .metric-card {
        background: #1a1a1a;
        color: #e0e0e0;
        border-color: #404040;
    }

    .form-input {
        background-color: white !important;
        border-color: #404040;
        color: #333;
    }

    .form-input::placeholder {
        color: #888;
    }

    .loading-content {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .table {
        background: #1a1a1a;
        color: #e0e0e0;
    }

    .table th {
        background: var(--primary-green);
    }

    .table tbody tr:hover {
        background-color: #2a2a2a;
    }
}

/* Animation utilities */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

.slide-up {
    animation: slideUp 0.3s ease-out;
}

.pulse {
    animation: pulse 2s infinite;
}

/* Utility classes */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }

.d-none { display: none; }
.d-block { display: block; }
.d-flex { display: flex; }
.d-grid { display: grid; }

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }

/* ================================================
   MOBILE RESPONSIVE DESIGN
   ================================================ */

/* Mobile-first responsive utilities */
.mobile-hidden { display: none; }
.desktop-hidden { display: block; }

@media (min-width: 768px) {
    .mobile-hidden { display: block; }
    .desktop-hidden { display: none; }
}

/* Mobile Navigation Toggle */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
}

/* Responsive breakpoints */
@media (max-width: 1024px) {
    /* Tablet adjustments */
    .header-content,
    .nav-content,
    .main {
        padding: 0 1.5rem;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    }
}

@media (max-width: 768px) {
    /* Mobile adjustments */

    /* Typography */
    .page-title {
        font-size: 1.5rem;
    }

    .logo {
        font-size: 1.3rem;
    }

    /* Header */
    .header-content {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
        text-align: center;
    }

    .organization-info {
        text-align: center;
    }

    .organization-info h2 {
        font-size: 1rem;
    }

    .organization-info p {
        font-size: 0.85rem;
    }

    .logout-container {
        justify-content: center;
        width: 100%;
    }

    .logout-btn {
        width: 100%;
        max-width: 300px;
    }

    /* Navigation */
    .nav-content {
        padding: 0 1rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .nav-tabs {
        min-width: max-content;
        padding-bottom: 0.5rem;
    }

    .nav-tab {
        margin-right: 0.5rem;
    }

    .nav-tab a {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        white-space: nowrap;
    }

    /* Main content */
    .main {
        padding: 1rem;
        margin: 1rem auto;
    }

    /* Cards */
    .card {
        margin-bottom: 1rem;
    }

    .card-header {
        padding: 0.75rem 1rem;
        font-size: 1rem;
    }

    .card-body {
        padding: 1rem;
    }

    .card-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    /* Metrics */
    .metrics-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .metric-card {
        padding: 1rem;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .metric-label {
        font-size: 0.8rem;
    }

    /* Buttons */
    .btn {
        padding: 0.6rem 1.2rem;
        font-size: 0.85rem;
        width: 100%;
        max-width: 100%;
    }

    /* Forms */
    .form-input {
        font-size: 16px; /* Prevents zoom on iOS */
    }

    /* Tables */
    .table {
        font-size: 0.85rem;
    }

    .table th,
    .table td {
        padding: 0.75rem 0.5rem;
    }

    /* Make tables horizontally scrollable on mobile */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Settings sections */
    .settings-section {
        padding: 1rem;
    }

    /* Profile sections */
    .profile-header {
        flex-direction: column;
        text-align: center;
    }

    .profile-actions {
        flex-direction: column;
        gap: 0.5rem;
        width: 100%;
    }

    /* Dashboard charts */
    canvas {
        max-height: 250px !important;
    }
}

@media (max-width: 480px) {
    /* Small mobile adjustments */

    .logo {
        font-size: 1.1rem;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .nav-tab a {
        padding: 0.6rem 0.8rem;
        font-size: 0.85rem;
    }

    .metrics-grid {
        grid-template-columns: 1fr;
    }

    .metric-card {
        padding: 0.75rem;
    }

    .metric-value {
        font-size: 1.3rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    .main {
        padding: 0.75rem;
    }

    /* Stack form buttons */
    .form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .form-actions .btn {
        width: 100%;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    /* Larger touch targets */
    .btn,
    .nav-tab a,
    .logout-btn {
        min-height: 44px;
        min-width: 44px;
    }

    /* Remove hover effects on touch devices */
    .btn:hover,
    .nav-tab a:hover {
        transform: none;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    .header-content {
        flex-direction: row;
        padding: 0.5rem 1rem;
    }

    .organization-info {
        text-align: right;
    }

    .logout-container {
        width: auto;
    }

    .logout-btn {
        width: auto;
    }
}

/* Print styles */
@media print {
    .header,
    .nav,
    .logout-btn,
    .btn {
        display: none;
    }

    .main {
        padding: 0;
        margin: 0;
    }

    .card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }
}