/* WWH Flask - Core Application Styles */
/* Default theme and styling for the entire application */

/* ===== MULTI-TENANT THEME SYSTEM ===== */
/* Default theme can be overridden by tenant-specific CSS files */
/* Example: modules/tenant-dtic.css can override these variables for DTIC tenant */
/* Example: modules/tenant-smalltown.css can override for Small Town Initiative */

/* ===== GLOBAL CSS VARIABLES (DEFAULT THEME) ===== */
:root {
    /* Consolidated Color Palette */
    --primary-50: #f0f9ff;
    --primary-100: #e0e7ff;
    --primary-200: #c7d2fe;
    --primary-300: #a5b4fc;
    --primary-400: #818cf8;
    --primary-500: #6366f1;
    --primary-600: #4f46e5;
    --primary-700: #4338ca;
    --primary-800: #3730a3;
    --primary-900: #312e81;

    /* Secondary Colors */
    --secondary-50: #f8fafc;
    --secondary-100: #f1f5f9;
    --secondary-200: #e2e8f0;
    --secondary-300: #cbd5e1;
    --secondary-400: #94a3b8;
    --secondary-500: #64748b;
    --secondary-600: #475569;
    --secondary-700: #334155;
    --secondary-800: #1e293b;
    --secondary-900: #0f172a;

    /* Neutral Colors */
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;

    /* Semantic Colors */
    --success-50: #ecfdf5;
    --success-100: #d1fae5;
    --success-200: #a7f3d0;
    --success-300: #6ee7b7;
    --success-400: #34d399;
    --success-500: #10b981;
    --success-600: #059669;
    --success-700: #047857;
    --success-800: #065f46;
    --success-900: #064e3b;

    --warning-50: #fffbeb;
    --warning-100: #fef3c7;
    --warning-200: #fde68a;
    --warning-300: #fcd34d;
    --warning-400: #fbbf24;
    --warning-500: #f59e0b;
    --warning-600: #d97706;
    --warning-700: #b45309;
    --warning-800: #92400e;
    --warning-900: #78350f;

    --error-50: #fef2f2;
    --error-100: #fee2e2;
    --error-200: #fecaca;
    --error-300: #fca5a5;
    --error-400: #f87171;
    --error-500: #ef4444;
    --error-600: #dc2626;
    --error-700: #b91c1c;
    --error-800: #991b1b;
    --error-900: #7f1d1d;

    /* Chart Colors */
    --chart-1: var(--primary-500);
    --chart-2: #8b5cf6;
    --chart-3: #10b981;

    /* Typography */
    --font-size-xs: 0.75rem;
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;
    --font-size-4xl: 2.25rem;

    /* Spacing */
    --spacing-1: 0.25rem;
    --spacing-2: 0.5rem;
    --spacing-4: 1rem;
    --spacing-6: 1.5rem;

    /* Border Radius */
    --radius-md: 0.375rem;
    --radius-lg: 0.5rem;

    /* Global Color Mappings */
    --brand-primary: var(--primary-500);
    --brand-text: var(--gray-700);
    --body-bg: var(--gray-100);
    --content-bg: white;

    /* Flash Messages */
    --flash-error-bg: var(--error-50);
    --flash-error-text: var(--error-800);
    --flash-success-bg: var(--success-50);
    --flash-success-text: var(--success-800);
    --flash-warning-bg: var(--warning-50);
    --flash-warning-text: var(--warning-800);
    --flash-info-bg: var(--primary-50);
    --flash-info-text: var(--primary-800);

    /* Navigation */
    --nav-bg: white;
    --nav-brand: var(--primary-600);
    --nav-text: var(--gray-600);
    --nav-text-hover: var(--primary-600);

    /* Required field styling */
    --required-asterisk-color: var(--error-500);

    /* Gradient Background */
    --gradient-start: var(--primary-100);
    --gradient-end: var(--primary-500);
}

/* ===== GLOBAL BUTTON STYLES ===== */

/* Primary Button - Uses primary theme colors */
.wwh-btn-primary {
    background-color: var(--primary-600);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    border: none;
    transition: background-color 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: var(--font-size-base);
}

.wwh-btn-primary:hover {
    background-color: var(--primary-700);
}

.wwh-btn-primary:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-600);
}

/* Secondary Button - Uses secondary theme colors */
.wwh-btn-secondary {
    background-color: var(--secondary-600);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    border: none;
    transition: background-color 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: var(--font-size-base);
}

.wwh-btn-secondary:hover {
    background-color: var(--secondary-700);
}

/* Semantic Buttons */
.wwh-btn-success {
    background-color: var(--success-600);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    border: none;
    transition: background-color 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.wwh-btn-success:hover {
    background-color: var(--success-700);
}

.wwh-btn-warning {
    background-color: var(--warning-600);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    border: none;
    transition: background-color 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.wwh-btn-warning:hover {
    background-color: var(--warning-700);
}

.wwh-btn-danger {
    background-color: var(--error-600);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    border: none;
    transition: background-color 0.2s ease-in-out;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}

.wwh-btn-danger:hover {
    background-color: var(--error-700);
}

/* ===== GLOBAL FORM STYLES ===== */

.wwh-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-md);
    font-size: var(--font-size-base);
    transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

.wwh-input:focus {
    outline: none;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 1px var(--primary-600);
}

.wwh-label {
    display: block;
    font-size: var(--font-size-sm);
    font-weight: 500;
    color: var(--gray-700);
    margin-bottom: 0.5rem;
}

/* ===== GLOBAL TEXT STYLES ===== */

.wwh-text-small {
    font-size: var(--font-size-sm);
    line-height: 1.25rem;
    color: var(--gray-600);
}

.wwh-text-link {
    font-weight: 500;
    color: var(--primary-600);
    text-decoration: none;
}

.wwh-text-link:hover {
    color: var(--primary-700);
}

/* ===== GLOBAL LAYOUT STYLES ===== */

.wwh-card {
    background-color: white;
    border-radius: var(--radius-lg);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border: 1px solid var(--gray-200);
}

.wwh-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-4);
}

/* ===== FORM VALIDATION STATES ===== */

.wwh-error-message {
    color: var(--error-600);
    font-size: var(--font-size-sm);
    line-height: 1.25rem;
    margin-top: var(--spacing-1);
}

.wwh-form-error input,
.wwh-form-error select,
.wwh-form-error textarea {
    border-color: var(--error-500);
}

.wwh-form-error input:focus,
.wwh-form-error select:focus,
.wwh-form-error textarea:focus {
    border-color: var(--error-500);
    box-shadow: 0 0 0 1px var(--error-500);
}

.wwh-form-success input,
.wwh-form-success select,
.wwh-form-success textarea {
    border-color: var(--success-500);
}

.wwh-form-success input:focus,
.wwh-form-success select:focus,
.wwh-form-success textarea:focus {
    border-color: var(--success-500);
    box-shadow: 0 0 0 1px var(--success-500);
}

/* ===== SPECIAL AUTH FORM STYLES ===== */
/* These handle the specific stacked input design for login forms */

.wwh-auth-input-stacked {
    appearance: none;
    border-radius: 0;
    position: relative;
    display: block;
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--gray-300);
    color: var(--gray-700);
    font-size: var(--font-size-sm);
    line-height: 1.25rem;
}

.wwh-auth-input-stacked::placeholder {
    color: var(--gray-500);
}

.wwh-auth-input-stacked:focus {
    outline: none;
    z-index: 10;
    border-color: var(--primary-600);
    box-shadow: 0 0 0 1px var(--primary-600);
}

.wwh-auth-input-top {
    border-top-left-radius: var(--radius-md);
    border-top-right-radius: var(--radius-md);
}

.wwh-auth-input-bottom {
    border-bottom-left-radius: var(--radius-md);
    border-bottom-right-radius: var(--radius-md);
}

/* Login button uses primary theme */
.wwh-auth-btn-login {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0.5rem 1rem;
    border: 1px solid transparent;
    font-size: var(--font-size-sm);
    line-height: 1.25rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    color: white;
    background-color: var(--primary-600);
    transition: background-color 0.2s ease-in-out;
}

.wwh-auth-btn-login:hover {
    background-color: var(--primary-700);
}

.wwh-auth-btn-login:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--primary-600), 0 0 0 4px rgba(99, 102, 241, 0.1);
}

/* Register button uses secondary theme */
.wwh-auth-btn-register {
    width: 100%;
    background-color: var(--secondary-600);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    transition: background-color 0.2s ease-in-out;
    border: none;
    font-size: var(--font-size-base);
    cursor: pointer;
}

.wwh-auth-btn-register:hover {
    background-color: var(--secondary-700);
}

.wwh-auth-btn-register:focus {
    outline: none;
    box-shadow: 0 0 0 2px var(--secondary-600);
}

/* ===== RECOMMENDED APPLICATION STYLES ===== */
.wwh-recommended-app {
    position: relative;
    transition: all 0.3s ease-in-out;
}

.wwh-recommended-app-highlighted {
    border: 2px solid var(--success-500) !important;
    background-color: var(--success-50) !important;
}

.wwh-recommended-app-highlighted:hover {
    background-color: var(--success-100) !important;
    border-color: var(--success-600) !important;
}

.wwh-recommended-badge {
    background-color: var(--success-100) !important;
    color: var(--success-700) !important;
}

/* Dark Mode Recommended Styles */
.wwh-border-bottom {
    border-bottom: 1px solid var(--gray-200);
}

.wwh-icon-sm {
    width: 1rem;
    height: 1rem;
}

.wwh-icon-md {
    width: 1.5rem;
    height: 1.5rem;
}

.wwh-icon-lg {
    width: 2rem;
    height: 2rem;
}

@media (prefers-color-scheme: dark) {
    .wwh-recommended-app-highlighted {
        border-color: var(--success-400) !important;
        background-color: rgba(16, 185, 129, 0.1) !important;
    }

    .wwh-recommended-app-highlighted:hover {
        background-color: rgba(16, 185, 129, 0.2) !important;
        border-color: var(--success-300) !important;
    }

    .wwh-recommended-badge {
        background-color: rgba(16, 185, 129, 0.2) !important;
        color: var(--success-300) !important;
    }
}

/* ===== NAVIGATION STYLES ===== */
.wwh-nav {
    background-color: var(--nav-bg);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid var(--gray-200);
}

.wwh-nav-brand {
    font-size: var(--font-size-xl);
    font-weight: 700;
    color: var(--nav-brand);
}

.wwh-nav-link {
    color: var(--nav-text);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-size: var(--font-size-sm);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease-in-out;
}

.wwh-nav-link:hover {
    color: var(--nav-text-hover);
}

/* ===== FLASH MESSAGE STYLES ===== */
.wwh-flash {
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: var(--radius-lg);
}

.wwh-flash-error {
    background-color: var(--flash-error-bg);
    color: var(--flash-error-text);
}

.wwh-flash-success {
    background-color: var(--flash-success-bg);
    color: var(--flash-success-text);
}

.wwh-flash-warning {
    background-color: var(--flash-warning-bg);
    color: var(--flash-warning-text);
}

.wwh-flash-info {
    background-color: var(--flash-info-bg);
    color: var(--flash-info-text);
}

/* ===== GLOBAL LAYOUT ENHANCEMENTS ===== */
.wwh-body {
    background-color: var(--body-bg);
    min-height: 100vh;
    font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
}

.wwh-main {
    background-color: var(--content-bg);
}

.wwh-footer {
    background-color: var(--content-bg);
    border-top: 1px solid var(--gray-200);
    margin-top: auto;
}

.wwh-footer-text {
    text-align: center;
    font-size: var(--font-size-sm);
    color: var(--gray-500);
}

/* ===== REQUIRED FIELD STYLING ===== */
.wwh-required-asterisk {
    color: var(--required-asterisk-color) !important;
    font-weight: bold !important;
    font-size: 1.1em !important;
}

/* ===== GRADIENT BACKGROUND UTILITY ===== */
.wwh-gradient-bg {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
}

/* Note: Most utility classes are now handled by Bootstrap and our bootstrap-override.css */

/* Retain only custom utility classes that are not standard in Bootstrap */
/* These classes might be used in Jinja2 templates or have specific requirements */

/* Custom WWH-specific utilities */
.wwh-gradient-bg {
    background: linear-gradient(135deg, var(--gradient-start) 0%, var(--gradient-end) 100%);
}

.wwh-hidden-md {
    display: none;
}

@media (min-width: 768px) {
    .wwh-hidden-md {
        display: block;
    }
}

.wwh-recommended-app {
    position: relative;
    transition: all 0.3s ease-in-out;
}

.wwh-recommended-app-highlighted {
    border: 2px solid var(--success-500) !important;
    background-color: var(--success-50) !important;
}

.wwh-recommended-app-highlighted:hover {
    background-color: var(--success-100) !important;
    border-color: var(--success-600) !important;
}

.wwh-recommended-badge {
    background-color: var(--success-100) !important;
    color: var(--success-700) !important;
}

@media (prefers-color-scheme: dark) {
    .wwh-recommended-app-highlighted {
        border-color: var(--success-400) !important;
        background-color: rgba(16, 185, 129, 0.1) !important;
    }

    .wwh-recommended-app-highlighted:hover {
        background-color: rgba(16, 185, 129, 0.2) !important;
        border-color: var(--success-300) !important;
    }

    .wwh-recommended-badge {
        background-color: rgba(16, 185, 129, 0.2) !important;
        color: var(--success-300) !important;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .wwh-no-print {
        display: none !important;
    }
    
    .wwh-card {
        box-shadow: none !important;
        border: 1px solid var(--gray-700) !important;
    }
    
    .wwh-btn-primary,
    .wwh-btn-secondary,
    .wwh-auth-btn-login,
    .wwh-auth-btn-register {
        background-color: white !important;
        color: black !important;
        border: 1px solid var(--gray-700) !important;
    }
    
    .wwh-gradient-bg {
        background: white !important;
    }
}
