/**
 * HVAC Certificates - Enhanced Styling
 * 
 * Updated certificate styling using the harmonized framework
 * for Generate Certificates and Certificate Reports pages.
 * 
 * @version 3.0.0
 */

/* Certificate pages wrapper */
.hvac-certificates-page {
    background-color: var(--hvac-theme-background);
    min-height: 70vh;
    padding: var(--hvac-spacing-6) 0;
}

/* Main container */
.hvac-certificates-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--hvac-spacing-4);
}

/* Page header */
.hvac-certificates-header {
    background: linear-gradient(135deg, var(--hvac-primary) 0%, var(--hvac-accent) 100%);
    color: white;
    padding: var(--hvac-spacing-8) var(--hvac-spacing-6);
    border-radius: var(--hvac-radius-xl);
    margin-bottom: var(--hvac-spacing-8);
    box-shadow: var(--hvac-shadow-lg);
    position: relative;
    overflow: hidden;
}

.hvac-certificates-header::before {
    content: '';
    position: absolute;
    top: -50px;
    right: -50px;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: scale(0.8);
}

.hvac-certificates-header h1 {
    font-size: var(--hvac-font-size-3xl);
    font-weight: var(--hvac-font-weight-bold);
    margin: 0 0 var(--hvac-spacing-2) 0;
    color: white;
}

.hvac-certificates-header p {
    font-size: var(--hvac-font-size-lg);
    margin: 0;
    opacity: 0.9;
    color: white;
}

/* Navigation breadcrumb */
.hvac-certificates-nav {
    display: flex;
    gap: var(--hvac-spacing-3);
    flex-wrap: wrap;
    margin-top: var(--hvac-spacing-6);
}

.hvac-certificates-nav .hvac-btn {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
    color: white;
    backdrop-filter: blur(10px);
}

.hvac-certificates-nav .hvac-btn:hover {
    background-color: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Main content area */
.hvac-certificates-content {
    background-color: var(--hvac-background-white);
    border-radius: var(--hvac-radius-xl);
    box-shadow: var(--hvac-shadow-lg);
    border: 1px solid var(--hvac-border);
    overflow: hidden;
    margin-bottom: var(--hvac-spacing-8);
}

/* Section headers */
.hvac-certificates-section-header {
    background: linear-gradient(135deg, var(--hvac-secondary-light) 0%, var(--hvac-background-gray) 100%);
    padding: var(--hvac-spacing-5) var(--hvac-spacing-6);
    border-bottom: 1px solid var(--hvac-border);
}

.hvac-certificates-section-header h2 {
    margin: 0;
    color: var(--hvac-theme-text-dark);
    font-size: var(--hvac-font-size-xl);
    font-weight: var(--hvac-font-weight-semibold);
}

/* Form sections */
.hvac-certificates-form-section {
    padding: var(--hvac-spacing-6);
    border-bottom: 1px solid var(--hvac-border-light);
}

.hvac-certificates-form-section:last-child {
    border-bottom: none;
}

.hvac-certificates-form-section h3 {
    margin-top: 0;
    margin-bottom: var(--hvac-spacing-4);
    color: var(--hvac-theme-text-dark);
    font-size: var(--hvac-font-size-lg);
    font-weight: var(--hvac-font-weight-semibold);
    display: flex;
    align-items: center;
    gap: var(--hvac-spacing-2);
}

.hvac-section-number {
    background-color: var(--hvac-primary);
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--hvac-font-size-sm);
    font-weight: var(--hvac-font-weight-bold);
}

/* Enhanced form controls */
.hvac-certificates-form-group {
    margin-bottom: var(--hvac-spacing-5);
}

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

.hvac-certificates-select,
.hvac-certificates-input {
    width: 100%;
    padding: var(--hvac-spacing-3) var(--hvac-spacing-4);
    border: 2px solid var(--hvac-border);
    border-radius: var(--hvac-radius-lg);
    font-size: var(--hvac-font-size-md);
    font-family: var(--hvac-font-family);
    background-color: var(--hvac-background-white);
    transition: all var(--hvac-transition-fast);
    box-sizing: border-box;
}

.hvac-certificates-select:focus,
.hvac-certificates-input:focus {
    border-color: var(--hvac-primary);
    box-shadow: 0 0 0 3px var(--hvac-primary-light);
    outline: none;
}

.hvac-certificates-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.75rem center;
    background-repeat: no-repeat;
    background-size: 1.5em 1.5em;
    padding-right: 2.5rem;
    appearance: none;
}

/* Attendee selection area */
.hvac-attendees-section {
    background-color: var(--hvac-primary-subtle);
    border: 2px dashed var(--hvac-primary);
    border-radius: var(--hvac-radius-lg);
    padding: var(--hvac-spacing-6);
    margin: var(--hvac-spacing-5) 0;
    transition: all var(--hvac-transition-normal);
}

.hvac-attendees-section.hvac-attendees-loaded {
    background-color: var(--hvac-background-white);
    border-style: solid;
    box-shadow: var(--hvac-shadow-md);
}

.hvac-attendees-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--hvac-spacing-4);
    margin-top: var(--hvac-spacing-4);
}

.hvac-attendee-card {
    background-color: var(--hvac-background-white);
    border: 1px solid var(--hvac-border);
    border-radius: var(--hvac-radius-lg);
    padding: var(--hvac-spacing-4);
    transition: all var(--hvac-transition-fast);
    cursor: pointer;
    position: relative;
}

.hvac-attendee-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--hvac-shadow-md);
    border-color: var(--hvac-primary);
}

.hvac-attendee-card.selected {
    border-color: var(--hvac-primary);
    background-color: var(--hvac-primary-light);
    box-shadow: var(--hvac-shadow-md);
}

.hvac-attendee-checkbox {
    position: absolute;
    top: var(--hvac-spacing-3);
    right: var(--hvac-spacing-3);
    width: 18px;
    height: 18px;
    accent-color: var(--hvac-primary);
}

.hvac-attendee-info h4 {
    margin: 0 0 var(--hvac-spacing-1) 0;
    color: var(--hvac-theme-text-dark);
    font-size: var(--hvac-font-size-md);
    font-weight: var(--hvac-font-weight-semibold);
}

.hvac-attendee-info p {
    margin: 0;
    color: var(--hvac-theme-text-light);
    font-size: var(--hvac-font-size-sm);
}

/* Action buttons */
.hvac-certificates-actions {
    padding: var(--hvac-spacing-6);
    background-color: var(--hvac-background-gray);
    border-top: 1px solid var(--hvac-border);
    display: flex;
    gap: var(--hvac-spacing-4);
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
}

.hvac-certificates-actions-left {
    display: flex;
    gap: var(--hvac-spacing-3);
    align-items: center;
}

.hvac-certificates-actions-right {
    display: flex;
    gap: var(--hvac-spacing-3);
    align-items: center;
}

/* Results and messages */
.hvac-certificates-results {
    margin-top: var(--hvac-spacing-6);
    padding: var(--hvac-spacing-6);
    background-color: var(--hvac-success-light);
    border: 1px solid var(--hvac-success);
    border-radius: var(--hvac-radius-lg);
    color: var(--hvac-success);
}

.hvac-certificates-error {
    margin-top: var(--hvac-spacing-6);
    padding: var(--hvac-spacing-6);
    background-color: var(--hvac-error-light);
    border: 1px solid var(--hvac-error);
    border-radius: var(--hvac-radius-lg);
    color: var(--hvac-error);
}

/* Certificate previews */
.hvac-certificate-previews {
    margin-top: var(--hvac-spacing-6);
    padding: var(--hvac-spacing-6);
    background-color: var(--hvac-background-white);
    border: 1px solid var(--hvac-border);
    border-radius: var(--hvac-radius-lg);
    box-shadow: var(--hvac-shadow-md);
}

.hvac-certificate-previews h4 {
    margin-top: 0;
    margin-bottom: var(--hvac-spacing-4);
    color: var(--hvac-theme-text-dark);
}

.hvac-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--hvac-spacing-3);
}

.hvac-preview-button {
    display: flex;
    align-items: center;
    gap: var(--hvac-spacing-2);
    padding: var(--hvac-spacing-3) var(--hvac-spacing-4);
    background-color: var(--hvac-accent-light);
    border: 1px solid var(--hvac-accent);
    border-radius: var(--hvac-radius-md);
    color: var(--hvac-accent);
    text-decoration: none;
    font-size: var(--hvac-font-size-sm);
    font-weight: var(--hvac-font-weight-medium);
    transition: all var(--hvac-transition-fast);
}

.hvac-preview-button:hover {
    background-color: var(--hvac-accent);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--hvac-shadow-md);
    text-decoration: none;
}

/* Certificate reports specific styles */
.hvac-certificate-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--hvac-spacing-4);
    margin-bottom: var(--hvac-spacing-8);
}

.hvac-stat-card {
    background: linear-gradient(135deg, var(--hvac-background-white) 0%, var(--hvac-primary-subtle) 100%);
    border: 1px solid var(--hvac-border);
    border-radius: var(--hvac-radius-xl);
    padding: var(--hvac-spacing-5);
    text-align: center;
    box-shadow: var(--hvac-shadow-md);
    position: relative;
    overflow: hidden;
}

.hvac-stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--hvac-primary), var(--hvac-accent));
}

.hvac-stat-number {
    font-size: var(--hvac-font-size-3xl);
    font-weight: var(--hvac-font-weight-bold);
    color: var(--hvac-primary);
    margin-bottom: var(--hvac-spacing-1);
    line-height: 1;
}

.hvac-stat-label {
    font-size: var(--hvac-font-size-sm);
    color: var(--hvac-theme-text);
    font-weight: var(--hvac-font-weight-medium);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Certificate table */
.hvac-certificate-table-container {
    background-color: var(--hvac-background-white);
    border-radius: var(--hvac-radius-xl);
    box-shadow: var(--hvac-shadow-lg);
    overflow: hidden;
    border: 1px solid var(--hvac-border);
}

.hvac-certificate-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.hvac-certificate-table th {
    background: linear-gradient(135deg, var(--hvac-secondary-light) 0%, var(--hvac-background-gray) 100%);
    color: var(--hvac-theme-text-dark);
    font-weight: var(--hvac-font-weight-semibold);
    text-align: left;
    padding: var(--hvac-spacing-4) var(--hvac-spacing-5);
    border-bottom: 2px solid var(--hvac-border);
    font-size: var(--hvac-font-size-sm);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

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

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

/* Certificate status badges */
.hvac-certificate-status {
    display: inline-flex;
    align-items: center;
    padding: var(--hvac-spacing-1) var(--hvac-spacing-3);
    border-radius: var(--hvac-radius-lg);
    font-size: var(--hvac-font-size-xs);
    font-weight: var(--hvac-font-weight-medium);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hvac-certificate-status--active {
    background-color: var(--hvac-success-light);
    color: var(--hvac-success);
    border: 1px solid var(--hvac-success);
}

.hvac-certificate-status--revoked {
    background-color: var(--hvac-error-light);
    color: var(--hvac-error);
    border: 1px solid var(--hvac-error);
}

.hvac-certificate-status--pending {
    background-color: var(--hvac-warning-light);
    color: var(--hvac-warning);
    border: 1px solid var(--hvac-warning);
}

/* Certificate actions */
.hvac-certificate-actions {
    display: flex;
    gap: var(--hvac-spacing-2);
    align-items: center;
}

.hvac-certificate-actions .hvac-btn {
    padding: var(--hvac-spacing-1) var(--hvac-spacing-3);
    font-size: var(--hvac-font-size-xs);
    min-height: 32px;
}

/* Loading states */
.hvac-certificates-loading {
    text-align: center;
    padding: var(--hvac-spacing-8);
    color: var(--hvac-theme-text-light);
}

.hvac-certificates-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--hvac-border);
    border-top: 3px solid var(--hvac-primary);
    border-radius: 50%;
    animation: hvac-spin 1s linear infinite;
    margin: 0 auto var(--hvac-spacing-4);
}

/* Empty states */
.hvac-certificates-empty {
    text-align: center;
    padding: var(--hvac-spacing-12) var(--hvac-spacing-6);
    background-color: var(--hvac-background-white);
    border-radius: var(--hvac-radius-xl);
    border: 2px dashed var(--hvac-border);
    color: var(--hvac-theme-text-light);
}

.hvac-certificates-empty-icon {
    font-size: 4rem;
    margin-bottom: var(--hvac-spacing-4);
    color: var(--hvac-border-dark);
}

.hvac-certificates-empty h3 {
    color: var(--hvac-theme-text);
    margin-bottom: var(--hvac-spacing-3);
}

/* Responsive design */
@media (max-width: 768px) {
    .hvac-certificates-container {
        padding: 0 var(--hvac-spacing-3);
    }
    
    .hvac-certificates-header {
        padding: var(--hvac-spacing-6) var(--hvac-spacing-4);
        text-align: center;
    }
    
    .hvac-certificates-header h1 {
        font-size: var(--hvac-font-size-2xl);
    }
    
    .hvac-certificates-form-section {
        padding: var(--hvac-spacing-4);
    }
    
    .hvac-certificate-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: var(--hvac-spacing-3);
    }
    
    .hvac-attendees-grid {
        grid-template-columns: 1fr;
    }
    
    .hvac-certificates-actions {
        flex-direction: column;
        gap: var(--hvac-spacing-3);
        align-items: stretch;
    }
    
    .hvac-certificates-actions-left,
    .hvac-certificates-actions-right {
        justify-content: center;
    }
    
    .hvac-preview-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .hvac-certificates-header,
    .hvac-certificates-form-section {
        padding: var(--hvac-spacing-3);
    }
    
    .hvac-certificate-table-container {
        overflow-x: auto;
    }
    
    .hvac-certificate-table th,
    .hvac-certificate-table td {
        padding: var(--hvac-spacing-2) var(--hvac-spacing-3);
        font-size: var(--hvac-font-size-xs);
    }
    
    .hvac-certificate-actions {
        flex-direction: column;
        gap: var(--hvac-spacing-1);
    }
    
    .hvac-certificate-actions .hvac-btn {
        width: 100%;
        justify-content: center;
    }
}

/* 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-certificates-page {
        background: white;
    }
    
    .hvac-certificates-header {
        background: #000;
        color: white;
        box-shadow: none;
    }
    
    .hvac-certificates-content,
    .hvac-certificate-table-container {
        box-shadow: none;
        border: 1px solid #000;
    }
    
    .hvac-certificates-actions {
        display: none;
    }
}