/**
 * HVAC Community Events - Harmonized Styling Framework
 * 
 * This file provides harmonized styling that integrates seamlessly with the
 * Astra WordPress theme while maintaining accessibility and responsive design.
 * 
 * Based on Astra theme analysis:
 * - Font: Mulish, sans-serif
 * - Body color: rgba(0, 0, 0, 0.65) 
 * - Background: rgb(236, 244, 243) (light teal)
 * - Base font size: 16px
 * - Line height: 1.7 (27.2px)
 * 
 * @version 3.0.0
 */

:root {
    /* Theme-harmonized color palette */
    --hvac-theme-background: rgb(236, 244, 243);
    --hvac-theme-text: rgba(0, 0, 0, 0.65);
    --hvac-theme-text-dark: rgba(0, 0, 0, 0.87);
    --hvac-theme-text-light: rgba(0, 0, 0, 0.54);
    
    /* Primary colors - Teal/Blue harmony */
    --hvac-primary: #008080;        /* Teal to match theme background */
    --hvac-primary-dark: #006666;   /* Darker teal */
    --hvac-primary-light: #e0f2f2;  /* Very light teal */
    --hvac-primary-subtle: #f0f9f9; /* Subtle teal background */
    
    /* Secondary colors - Natural grays */
    --hvac-secondary: #4a5568;      /* Neutral gray */
    --hvac-secondary-dark: #2d3748; /* Dark gray */
    --hvac-secondary-light: #f7fafc; /* Very light gray */
    
    /* Accent colors */
    --hvac-accent: #2b6cb0;         /* Blue accent */
    --hvac-accent-dark: #2a5396;
    --hvac-accent-light: #ebf8ff;
    
    /* Semantic colors */
    --hvac-success: #38a169;        /* Green */
    --hvac-success-light: #f0fff4;
    --hvac-warning: #d69e2e;        /* Orange */
    --hvac-warning-light: #fffaf0;
    --hvac-error: #e53e3e;          /* Red */
    --hvac-error-light: #fed7d7;
    --hvac-info: --hvac-accent;     /* Use accent color */
    --hvac-info-light: var(--hvac-accent-light);
    
    /* Border and background colors */
    --hvac-border: #e2e8f0;
    --hvac-border-light: #f7fafc;
    --hvac-border-dark: #cbd5e0;
    --hvac-background-white: #ffffff;
    --hvac-background-gray: #f8f9fa;
    
    /* Typography settings to match Astra theme */
    --hvac-font-family: 'Mulish', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, sans-serif;
    --hvac-font-size-base: 16px;
    --hvac-line-height-base: 1.7;
    --hvac-font-weight-normal: 400;
    --hvac-font-weight-medium: 500;
    --hvac-font-weight-semibold: 600;
    --hvac-font-weight-bold: 700;
    
    /* Font sizes - Type scale */
    --hvac-font-size-xs: 0.75rem;   /* 12px */
    --hvac-font-size-sm: 0.875rem;  /* 14px */
    --hvac-font-size-md: 1rem;      /* 16px */
    --hvac-font-size-lg: 1.125rem;  /* 18px */
    --hvac-font-size-xl: 1.25rem;   /* 20px */
    --hvac-font-size-2xl: 1.5rem;   /* 24px */
    --hvac-font-size-3xl: 1.875rem; /* 30px */
    --hvac-font-size-4xl: 2.25rem;  /* 36px */
    
    /* Spacing scale - Consistent with Astra */
    --hvac-spacing-1: 0.25rem;  /* 4px */
    --hvac-spacing-2: 0.5rem;   /* 8px */
    --hvac-spacing-3: 0.75rem;  /* 12px */
    --hvac-spacing-4: 1rem;     /* 16px */
    --hvac-spacing-5: 1.25rem;  /* 20px */
    --hvac-spacing-6: 1.5rem;   /* 24px */
    --hvac-spacing-8: 2rem;     /* 32px */
    --hvac-spacing-10: 2.5rem;  /* 40px */
    --hvac-spacing-12: 3rem;    /* 48px */
    --hvac-spacing-16: 4rem;    /* 64px */
    
    /* Border radius */
    --hvac-radius-sm: 0.25rem;  /* 4px */
    --hvac-radius-md: 0.375rem; /* 6px */
    --hvac-radius-lg: 0.5rem;   /* 8px */
    --hvac-radius-xl: 0.75rem;  /* 12px */
    --hvac-radius-2xl: 1rem;    /* 16px */
    
    /* Shadows - Subtle and modern */
    --hvac-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --hvac-shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --hvac-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --hvac-shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    
    /* Transitions */
    --hvac-transition-fast: 150ms ease-out;
    --hvac-transition-normal: 250ms ease-out;
    --hvac-transition-slow: 350ms ease-out;
    
    /* Z-index scale */
    --hvac-z-dropdown: 1000;
    --hvac-z-modal: 1050;
    --hvac-z-popover: 1060;
    --hvac-z-tooltip: 1070;
}

/* Base typography - Apply Astra theme styling */
.hvac-page,
.hvac-content {
    font-family: var(--hvac-font-family);
    font-size: var(--hvac-font-size-base);
    line-height: var(--hvac-line-height-base);
    color: var(--hvac-theme-text);
}

/* Typography hierarchy */
.hvac-content h1,
.hvac-content .hvac-h1 {
    font-size: var(--hvac-font-size-3xl);
    font-weight: var(--hvac-font-weight-bold);
    line-height: 1.2;
    color: var(--hvac-theme-text-dark);
    margin-bottom: var(--hvac-spacing-6);
    margin-top: 0;
}

.hvac-content h2,
.hvac-content .hvac-h2 {
    font-size: var(--hvac-font-size-2xl);
    font-weight: var(--hvac-font-weight-semibold);
    line-height: 1.3;
    color: var(--hvac-theme-text-dark);
    margin-bottom: var(--hvac-spacing-4);
    margin-top: var(--hvac-spacing-8);
}

.hvac-content h3,
.hvac-content .hvac-h3 {
    font-size: var(--hvac-font-size-xl);
    font-weight: var(--hvac-font-weight-semibold);
    line-height: 1.4;
    color: var(--hvac-theme-text-dark);
    margin-bottom: var(--hvac-spacing-3);
    margin-top: var(--hvac-spacing-6);
}

.hvac-content h4,
.hvac-content .hvac-h4 {
    font-size: var(--hvac-font-size-lg);
    font-weight: var(--hvac-font-weight-medium);
    line-height: 1.4;
    color: var(--hvac-theme-text-dark);
    margin-bottom: var(--hvac-spacing-3);
    margin-top: var(--hvac-spacing-5);
}

.hvac-content p,
.hvac-content .hvac-text {
    margin-bottom: var(--hvac-spacing-4);
    line-height: var(--hvac-line-height-base);
    color: var(--hvac-theme-text);
}

/* Text utilities */
.hvac-text-xs { font-size: var(--hvac-font-size-xs); }
.hvac-text-sm { font-size: var(--hvac-font-size-sm); }
.hvac-text-md { font-size: var(--hvac-font-size-md); }
.hvac-text-lg { font-size: var(--hvac-font-size-lg); }
.hvac-text-xl { font-size: var(--hvac-font-size-xl); }

.hvac-text-light { color: var(--hvac-theme-text-light); }
.hvac-text-normal { color: var(--hvac-theme-text); }
.hvac-text-dark { color: var(--hvac-theme-text-dark); }

.hvac-font-normal { font-weight: var(--hvac-font-weight-normal); }
.hvac-font-medium { font-weight: var(--hvac-font-weight-medium); }
.hvac-font-semibold { font-weight: var(--hvac-font-weight-semibold); }
.hvac-font-bold { font-weight: var(--hvac-font-weight-bold); }

/* Enhanced button system */
.hvac-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--hvac-spacing-3) var(--hvac-spacing-6);
    font-family: var(--hvac-font-family);
    font-size: var(--hvac-font-size-md);
    font-weight: var(--hvac-font-weight-medium);
    line-height: 1.5;
    text-decoration: none;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    user-select: none;
    border: 1px solid transparent;
    border-radius: var(--hvac-radius-md);
    transition: all var(--hvac-transition-fast);
    min-height: 44px; /* WCAG touch target size */
    position: relative;
    overflow: hidden;
    background-image: none;
}

.hvac-btn:focus {
    outline: 2px solid var(--hvac-primary);
    outline-offset: 2px;
    z-index: 10;
}

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

.hvac-btn-primary:hover:not(:disabled) {
    background-color: var(--hvac-primary-dark);
    border-color: var(--hvac-primary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--hvac-shadow-md);
}

.hvac-btn-primary:active {
    transform: translateY(0);
    box-shadow: var(--hvac-shadow-sm);
}

.hvac-btn-secondary {
    background-color: var(--hvac-secondary);
    border-color: var(--hvac-secondary);
    color: white;
    box-shadow: var(--hvac-shadow-sm);
}

.hvac-btn-secondary:hover:not(:disabled) {
    background-color: var(--hvac-secondary-dark);
    border-color: var(--hvac-secondary-dark);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--hvac-shadow-md);
}

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

.hvac-btn-outline:hover:not(:disabled) {
    background-color: var(--hvac-primary);
    color: white;
}

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

.hvac-btn-ghost:hover:not(:disabled) {
    background-color: var(--hvac-primary-light);
    color: var(--hvac-primary-dark);
}

/* Button sizes */
.hvac-btn-sm {
    padding: var(--hvac-spacing-2) var(--hvac-spacing-4);
    font-size: var(--hvac-font-size-sm);
    min-height: 36px;
}

.hvac-btn-lg {
    padding: var(--hvac-spacing-4) var(--hvac-spacing-8);
    font-size: var(--hvac-font-size-lg);
    min-height: 52px;
}

.hvac-btn-xl {
    padding: var(--hvac-spacing-5) var(--hvac-spacing-10);
    font-size: var(--hvac-font-size-xl);
    min-height: 60px;
}

/* Button states */
.hvac-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* Form elements */
.hvac-form-group {
    margin-bottom: var(--hvac-spacing-6);
}

.hvac-form-label {
    display: block;
    margin-bottom: var(--hvac-spacing-2);
    font-weight: var(--hvac-font-weight-medium);
    color: var(--hvac-theme-text-dark);
    font-size: var(--hvac-font-size-sm);
}

.hvac-form-control {
    display: block;
    width: 100%;
    padding: var(--hvac-spacing-3);
    font-family: var(--hvac-font-family);
    font-size: var(--hvac-font-size-md);
    font-weight: var(--hvac-font-weight-normal);
    line-height: var(--hvac-line-height-base);
    color: var(--hvac-theme-text);
    background-color: var(--hvac-background-white);
    border: 1px solid var(--hvac-border);
    border-radius: var(--hvac-radius-md);
    transition: border-color var(--hvac-transition-fast), box-shadow var(--hvac-transition-fast);
}

.hvac-form-control:focus {
    border-color: var(--hvac-primary);
    outline: 0;
    box-shadow: 0 0 0 3px var(--hvac-primary-light);
}

.hvac-form-control:disabled {
    background-color: var(--hvac-background-gray);
    opacity: 0.6;
}

/* Select elements */
.hvac-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;
}

/* Card component */
.hvac-card {
    background-color: var(--hvac-background-white);
    border: 1px solid var(--hvac-border);
    border-radius: var(--hvac-radius-lg);
    box-shadow: var(--hvac-shadow-sm);
    overflow: hidden;
    transition: box-shadow var(--hvac-transition-normal);
}

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

.hvac-card-header {
    padding: var(--hvac-spacing-6);
    border-bottom: 1px solid var(--hvac-border-light);
    background-color: var(--hvac-background-gray);
}

.hvac-card-body {
    padding: var(--hvac-spacing-6);
}

.hvac-card-footer {
    padding: var(--hvac-spacing-6);
    border-top: 1px solid var(--hvac-border-light);
    background-color: var(--hvac-background-gray);
}

/* Tables */
.hvac-table-container {
    overflow-x: auto;
    margin-bottom: var(--hvac-spacing-6);
    border-radius: var(--hvac-radius-lg);
    border: 1px solid var(--hvac-border);
}

.hvac-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--hvac-background-white);
    font-size: var(--hvac-font-size-sm);
}

.hvac-table th {
    background-color: var(--hvac-background-gray);
    color: var(--hvac-theme-text-dark);
    font-weight: var(--hvac-font-weight-semibold);
    text-align: left;
    padding: var(--hvac-spacing-4);
    border-bottom: 1px solid var(--hvac-border);
    white-space: nowrap;
}

.hvac-table td {
    padding: var(--hvac-spacing-4);
    border-bottom: 1px solid var(--hvac-border-light);
    vertical-align: middle;
}

.hvac-table tbody tr:hover {
    background-color: var(--hvac-primary-subtle);
}

.hvac-table tbody tr:last-child td {
    border-bottom: none;
}

/* Alert components */
.hvac-alert {
    padding: var(--hvac-spacing-4);
    margin-bottom: var(--hvac-spacing-6);
    border: 1px solid transparent;
    border-radius: var(--hvac-radius-md);
    font-size: var(--hvac-font-size-sm);
}

.hvac-alert-success {
    background-color: var(--hvac-success-light);
    border-color: var(--hvac-success);
    color: var(--hvac-success);
}

.hvac-alert-warning {
    background-color: var(--hvac-warning-light);
    border-color: var(--hvac-warning);
    color: var(--hvac-warning);
}

.hvac-alert-error {
    background-color: var(--hvac-error-light);
    border-color: var(--hvac-error);
    color: var(--hvac-error);
}

.hvac-alert-info {
    background-color: var(--hvac-info-light);
    border-color: var(--hvac-accent);
    color: var(--hvac-accent);
}

/* Spacing utilities */
.hvac-m-0 { margin: 0; }
.hvac-m-1 { margin: var(--hvac-spacing-1); }
.hvac-m-2 { margin: var(--hvac-spacing-2); }
.hvac-m-3 { margin: var(--hvac-spacing-3); }
.hvac-m-4 { margin: var(--hvac-spacing-4); }
.hvac-m-5 { margin: var(--hvac-spacing-5); }
.hvac-m-6 { margin: var(--hvac-spacing-6); }
.hvac-m-8 { margin: var(--hvac-spacing-8); }

.hvac-mt-0 { margin-top: 0; }
.hvac-mt-1 { margin-top: var(--hvac-spacing-1); }
.hvac-mt-2 { margin-top: var(--hvac-spacing-2); }
.hvac-mt-3 { margin-top: var(--hvac-spacing-3); }
.hvac-mt-4 { margin-top: var(--hvac-spacing-4); }
.hvac-mt-6 { margin-top: var(--hvac-spacing-6); }
.hvac-mt-8 { margin-top: var(--hvac-spacing-8); }

.hvac-mb-0 { margin-bottom: 0; }
.hvac-mb-1 { margin-bottom: var(--hvac-spacing-1); }
.hvac-mb-2 { margin-bottom: var(--hvac-spacing-2); }
.hvac-mb-3 { margin-bottom: var(--hvac-spacing-3); }
.hvac-mb-4 { margin-bottom: var(--hvac-spacing-4); }
.hvac-mb-6 { margin-bottom: var(--hvac-spacing-6); }
.hvac-mb-8 { margin-bottom: var(--hvac-spacing-8); }

.hvac-p-0 { padding: 0; }
.hvac-p-1 { padding: var(--hvac-spacing-1); }
.hvac-p-2 { padding: var(--hvac-spacing-2); }
.hvac-p-3 { padding: var(--hvac-spacing-3); }
.hvac-p-4 { padding: var(--hvac-spacing-4); }
.hvac-p-6 { padding: var(--hvac-spacing-6); }
.hvac-p-8 { padding: var(--hvac-spacing-8); }

/* Layout utilities */
.hvac-flex { display: flex; }
.hvac-inline-flex { display: inline-flex; }
.hvac-block { display: block; }
.hvac-inline-block { display: inline-block; }
.hvac-hidden { display: none; }

.hvac-flex-row { flex-direction: row; }
.hvac-flex-col { flex-direction: column; }
.hvac-flex-wrap { flex-wrap: wrap; }
.hvac-flex-nowrap { flex-wrap: nowrap; }

.hvac-items-start { align-items: flex-start; }
.hvac-items-center { align-items: center; }
.hvac-items-end { align-items: flex-end; }
.hvac-items-stretch { align-items: stretch; }

.hvac-justify-start { justify-content: flex-start; }
.hvac-justify-center { justify-content: center; }
.hvac-justify-end { justify-content: flex-end; }
.hvac-justify-between { justify-content: space-between; }
.hvac-justify-around { justify-content: space-around; }

.hvac-gap-1 { gap: var(--hvac-spacing-1); }
.hvac-gap-2 { gap: var(--hvac-spacing-2); }
.hvac-gap-3 { gap: var(--hvac-spacing-3); }
.hvac-gap-4 { gap: var(--hvac-spacing-4); }
.hvac-gap-6 { gap: var(--hvac-spacing-6); }

/* Grid utilities */
.hvac-grid { display: grid; }
.hvac-grid-cols-1 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
.hvac-grid-cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.hvac-grid-cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hvac-grid-cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* Responsive design */
@media (max-width: 640px) {
    .hvac-grid-cols-2 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .hvac-grid-cols-3 { grid-template-columns: repeat(1, minmax(0, 1fr)); }
    .hvac-grid-cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    
    .hvac-btn {
        width: 100%;
        margin-bottom: var(--hvac-spacing-2);
    }
    
    .hvac-flex {
        flex-direction: column;
    }
    
    .hvac-content h1 {
        font-size: var(--hvac-font-size-2xl);
    }
    
    .hvac-content h2 {
        font-size: var(--hvac-font-size-xl);
    }
}

@media (max-width: 480px) {
    .hvac-card-body,
    .hvac-card-header,
    .hvac-card-footer {
        padding: var(--hvac-spacing-4);
    }
    
    .hvac-table th,
    .hvac-table td {
        padding: var(--hvac-spacing-2);
        font-size: var(--hvac-font-size-xs);
    }
}

/* Focus management for accessibility */
.hvac-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;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --hvac-border: #000000;
        --hvac-border-light: #333333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .hvac-btn,
    .hvac-card,
    .hvac-form-control {
        transition: none;
    }
}

/* Print styles */


/* Focus Management Styles - WCAG 2.1 Compliance */
/* Added for keyboard accessibility and screen reader support */

/* Button Focus Styles */
.hvac-button:focus,
.hvac-content .button:focus,
.hvac-content button:focus,
.hvac-content input[type="submit"]:focus,
.hvac-email-submit:focus,
.hvac-filter-submit:focus,
.hvac-certificate-actions button:focus,
.hvac-certificate-actions a:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.2);
    border-radius: 4px;
}

/* Input Focus Styles */
.hvac-form-input:focus,
.hvac-content input[type="text"]:focus,
.hvac-content input[type="email"]:focus,
.hvac-content input[type="password"]:focus,
.hvac-content input[type="url"]:focus,
.hvac-content textarea:focus,
.hvac-content select:focus,
.hvac-email-form-row input:focus,
.hvac-email-form-row textarea:focus,
.hvac-filter-group input:focus,
.hvac-filter-group select:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    border-color: #005fcc;
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.2);
}

/* Link Focus Styles */
.hvac-content a:focus,
.hvac-event-link:focus,
.hvac-certificate-link:focus,
.hvac-attendee-profile-icon:focus,
.hvac-dashboard-nav a:focus,
.hvac-email-navigation a:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    text-decoration: underline;
    background-color: rgba(0, 95, 204, 0.1);
    border-radius: 2px;
}

/* Interactive Element Focus Styles */
.hvac-attendee-checkbox:focus,
.hvac-select-all-container input[type="checkbox"]:focus,
.hvac-modal-close:focus,
.hvac-certificate-table tr:focus {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(0, 95, 204, 0.2);
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .hvac-content *:focus {
        outline: 3px solid #000000;
        outline-offset: 2px;
        background-color: #ffff00;
        color: #000000;
    }
}

/* Focus-visible polyfill support */

/* Reset focus for mouse users while preserving keyboard accessibility */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
    box-shadow: none;
}

/* Ensure focus is visible for keyboard users */
.js-focus-visible .focus-visible {
    outline: 2px solid #005fcc;
    outline-offset: 2px;
}

@media print {
    .hvac-btn,
    .hvac-card {
        box-shadow: none;
    }
    
    .hvac-table {
        border-collapse: collapse;
    }
    
    .hvac-table th,
    .hvac-table td {
        border: 1px solid #000;
    }
}