/**
 * HVAC Community Events Common Styles
 * 
 * These styles apply to all pages in the HVAC Community Events plugin.
 * They enhance buttons, links, typography, and spacing for a consistent look.
 */

:root {
    /* Primary colors */
    --hvac-primary: #0274be;
    --hvac-primary-dark: #005fa3;
    --hvac-primary-light: #e6f3fb;
    
    /* Secondary colors */
    --hvac-secondary: #54595f;
    --hvac-secondary-dark: #3a3f44;
    --hvac-secondary-light: #f0f0f1;
    
    /* Success/Error colors */
    --hvac-success: #4caf50;
    --hvac-success-light: #e8f5e9;
    --hvac-error: #d63638;
    --hvac-error-light: #ffebe9;
    
    /* Neutral colors */
    --hvac-border: #e0e0e0;
    --hvac-border-light: #f0f0f0;
    --hvac-text: #333333;
    --hvac-text-light: #757575;
    
    /* Spacing */
    --hvac-spacing-xs: 0.25rem;  /* 4px */
    --hvac-spacing-sm: 0.5rem;   /* 8px */
    --hvac-spacing-md: 1rem;     /* 16px */
    --hvac-spacing-lg: 1.5rem;   /* 24px */
    --hvac-spacing-xl: 2rem;     /* 32px */
    
    /* Border radius */
    --hvac-border-radius: 4px;
    --hvac-border-radius-lg: 8px;
    
    /* Box shadow */
    --hvac-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    --hvac-shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.1);
    
    /* Focus styles */
    --hvac-focus-color: #2271b1;
    --hvac-focus-width: 2px;
    --hvac-focus-offset: 2px;
}

/* Typography Enhancements */
.hvac-content h1, 
.hvac-content h2, 
.hvac-content h3,
.hvac-content h4 {
    color: var(--hvac-text);
    font-weight: 600;
    margin-bottom: var(--hvac-spacing-md);
    line-height: 1.3;
}

.hvac-content h1 {
    font-size: 1.75rem;
    margin-bottom: var(--hvac-spacing-lg);
}

.hvac-content h2 {
    font-size: 1.5rem;
    margin-top: var(--hvac-spacing-xl);
}

.hvac-content h3 {
    font-size: 1.25rem;
    margin-top: var(--hvac-spacing-lg);
}

.hvac-content p {
    margin-bottom: var(--hvac-spacing-md);
    line-height: 1.6;
    color: var(--hvac-text);
}

/* Enhanced Button Styles */
.hvac-button,
.hvac-content .button,
.hvac-content button[type="submit"],
.hvac-content input[type="submit"],
.hvac-content .ast-button {
    display: inline-block;
    background-color: var(--hvac-primary);
    color: white !important;
    padding: 0.75rem 1.25rem;
    border: none;
    border-radius: var(--hvac-border-radius);
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    box-shadow: var(--hvac-shadow);
    line-height: 1.4;
    min-height: 44px; /* Minimum touch target size */
    position: relative;
    overflow: hidden;
}

.hvac-button:hover,
.hvac-content .button:hover,
.hvac-content button[type="submit"]:hover,
.hvac-content input[type="submit"]:hover,
.hvac-content .ast-button:hover {
    background-color: var(--hvac-primary-dark);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: var(--hvac-shadow-lg);
}

.hvac-button:active,
.hvac-content .button:active,
.hvac-content button[type="submit"]:active,
.hvac-content input[type="submit"]:active,
.hvac-content .ast-button:active {
    transform: translateY(0);
    box-shadow: var(--hvac-shadow);
}

/* Button ripple effect */
.hvac-button::after,
.hvac-content .button::after,
.hvac-content button[type="submit"]::after,
.hvac-content input[type="submit"]::after,
.hvac-content .ast-button::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.5);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%, -50%);
    transform-origin: 50% 50%;
}

.hvac-button:active::after,
.hvac-content .button:active::after,
.hvac-content button[type="submit"]:active::after,
.hvac-content input[type="submit"]:active::after,
.hvac-content .ast-button:active::after {
    animation: ripple 0.4s ease-out;
}

/* Secondary buttons */
.hvac-button-secondary,
.hvac-content .button-secondary {
    background-color: var(--hvac-secondary);
}

.hvac-button-secondary:hover,
.hvac-content .button-secondary:hover {
    background-color: var(--hvac-secondary-dark);
}

/* Success/danger button variants */
.hvac-button-success,
.hvac-content .button-success {
    background-color: var(--hvac-success);
}

.hvac-button-success:hover,
.hvac-content .button-success:hover {
    background-color: var(--hvac-success);
    filter: brightness(0.9);
}

.hvac-button-danger,
.hvac-content .button-danger {
    background-color: var(--hvac-error);
}

.hvac-button-danger:hover,
.hvac-content .button-danger:hover {
    background-color: var(--hvac-error);
    filter: brightness(0.9);
}

/* Outline button variant */
.hvac-button-outline,
.hvac-content .button-outline {
    background-color: transparent;
    color: var(--hvac-primary) !important;
    border: 2px solid var(--hvac-primary);
    box-shadow: none;
}

.hvac-button-outline:hover,
.hvac-content .button-outline:hover {
    background-color: var(--hvac-primary-light);
    color: var(--hvac-primary) !important;
    box-shadow: var(--hvac-shadow);
}

/* Mobile optimized buttons */
@media (max-width: 480px) {
    .hvac-button,
    .hvac-content .button,
    .hvac-content button[type="submit"],
    .hvac-content input[type="submit"],
    .hvac-content .ast-button {
        padding: 0.85rem 1rem;
        width: 100%;
        max-width: 100%;
        display: block;
        font-size: 1rem;
        margin-bottom: var(--hvac-spacing-sm);
    }
    
    /* Fix for buttons in a row on mobile */
    .hvac-button-group {
        display: flex;
        flex-direction: column;
        gap: var(--hvac-spacing-sm);
        width: 100%;
    }
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.7;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.5;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* Enhanced Link Styles */
.hvac-content a:not(.button):not(.hvac-button) {
    color: var(--hvac-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.hvac-content a:not(.button):not(.hvac-button):hover {
    color: var(--hvac-primary-dark);
    text-decoration: underline;
}

/* Responsive Table Improvements */
.hvac-table-wrapper {
    overflow-x: auto;
    margin-bottom: var(--hvac-spacing-lg);
}

.hvac-table {
    width: 100%;
    border-collapse: collapse;
    border: 1px solid var(--hvac-border);
    background-color: white;
}

.hvac-table th {
    background-color: var(--hvac-secondary-light);
    color: var(--hvac-secondary-dark);
    font-weight: 600;
    text-align: left;
    padding: var(--hvac-spacing-md);
    border-bottom: 2px solid var(--hvac-border);
}

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

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

/* Card Component Styles */
.hvac-card {
    background-color: white;
    border-radius: var(--hvac-border-radius);
    box-shadow: var(--hvac-shadow);
    padding: var(--hvac-spacing-lg);
    margin-bottom: var(--hvac-spacing-lg);
    border: 1px solid var(--hvac-border);
}

.hvac-card-title {
    margin-top: 0;
    margin-bottom: var(--hvac-spacing-md);
    padding-bottom: var(--hvac-spacing-sm);
    border-bottom: 1px solid var(--hvac-border-light);
}

/* Form Element Improvements */
.hvac-form-group {
    margin-bottom: var(--hvac-spacing-lg);
}

.hvac-form-label {
    display: block;
    margin-bottom: var(--hvac-spacing-sm);
    font-weight: 600;
    color: var(--hvac-text);
}

.hvac-form-input,
.hvac-content input[type="text"],
.hvac-content input[type="email"],
.hvac-content input[type="password"],
.hvac-content input[type="url"],
.hvac-content textarea,
.hvac-content select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--hvac-border);
    border-radius: var(--hvac-border-radius);
    font-size: 1rem;
    background-color: white;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.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 {
    border-color: var(--hvac-primary);
    outline: none;
    box-shadow: 0 0 0 3px var(--hvac-primary-light);
}

/* Alert/Message Styles */
.hvac-alert {
    padding: var(--hvac-spacing-md);
    border-radius: var(--hvac-border-radius);
    margin-bottom: var(--hvac-spacing-lg);
    border-left: 4px solid transparent;
}

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

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

/* Layout Helper Classes */
.hvac-flex {
    display: flex;
}

.hvac-flex-between {
    justify-content: space-between;
}

.hvac-flex-center {
    align-items: center;
}

.hvac-flex-wrap {
    flex-wrap: wrap;
}

.hvac-mt-sm { margin-top: var(--hvac-spacing-sm); }
.hvac-mt-md { margin-top: var(--hvac-spacing-md); }
.hvac-mb-sm { margin-bottom: var(--hvac-spacing-sm); }
.hvac-mb-md { margin-bottom: var(--hvac-spacing-md); }
.hvac-mb-lg { margin-bottom: var(--hvac-spacing-lg); }
.hvac-mr-sm { margin-right: var(--hvac-spacing-sm); }

/* Accessibility Focus Styles */
.hvac-button:focus,
.hvac-content .button:focus,
.hvac-content button:focus,
.hvac-content input[type="submit"]:focus,
.hvac-content input[type="button"]:focus,
.hvac-content .ast-button:focus {
    outline: var(--hvac-focus-width) solid var(--hvac-focus-color);
    outline-offset: var(--hvac-focus-offset);
    box-shadow: none;
    position: relative;
    z-index: 1;
}

.hvac-content a:focus,
.hvac-content [tabindex="0"]:focus {
    outline: var(--hvac-focus-width) solid var(--hvac-focus-color);
    outline-offset: var(--hvac-focus-offset);
    border-radius: 2px;
}

.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 {
    outline: none; /* Remove default outline */
    border-color: var(--hvac-focus-color);
    box-shadow: 0 0 0 var(--hvac-focus-width) rgba(34, 113, 177, 0.3);
}

/* High contrast focus style for keyboard navigation */
.keyboard-nav-active :focus {
    outline: 3px solid #ffbf47 !important;
    outline-offset: var(--hvac-focus-offset) !important;
}

/* Skip link for keyboard users */
.hvac-skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    z-index: 100;
    background: var(--hvac-primary);
    color: white;
    padding: 10px;
    transition: top 0.2s;
}

.hvac-skip-link:focus {
    top: 0;
    outline: var(--hvac-focus-width) solid var(--hvac-focus-color);
}

/* Responsive improvements */
@media (max-width: 767px) {
    .hvac-flex {
        flex-direction: column;
    }
    
    .hvac-form-group {
        margin-bottom: var(--hvac-spacing-md);
    }
    
    .hvac-card {
        padding: var(--hvac-spacing-md);
    }
}

/* Apply to all plugin pages */
body.page-hvac-dashboard,
body.page-community-login,
body.page-trainer-registration,
body.page-trainer-profile,
body.page-event-summary,
body.page-email-attendees,
body.page-my-events,
body.page-manage-event {
    /* Base font settings */
    font-size: 16px;
    line-height: 1.6;
    color: var(--hvac-text);
}

/* Enable detection of keyboard navigation for better accessibility */
body:not(.user-is-tabbing) :focus {
    outline: none !important;
}