/**
 * Advisory Board Vote Plugin - Authentication Styles
 * USACS Color Scheme - Red Primary
 */

/* Hide navigation */
.site-header,
.main-navigation,
.nav-menu,
.menu,
.wp-block-navigation,
.wp-block-site-title,
.wp-block-site-tagline {
    display: none !important;
}

/* Remove header spacing */
.site-header {
    height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

/* Hide footer and other navigation elements */
.site-footer,
.footer-navigation,
.wp-block-template-part,
.wp-block-navigation,
nav,
.menu,
.nav-menu,
.main-navigation,
.secondary-navigation {
    display: none !important;
}

/* Hide page titles */
.wp-block-post-title,
.entry-title,
.page-title,
h1.entry-title {
    display: none !important;
}

/* Clean up body and main content */
body {
    background: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #333333;
    line-height: 1.6;
    overflow-x: hidden; /* Prevent horizontal scrolling globally */
    width: 100%;
    box-sizing: border-box;
}

.main-content,
.site-main,
.content-area {
    padding: 0 !important;
    margin: 0 !important;
    overflow-x: hidden; /* Prevent horizontal scrolling */
    width: 100%;
    box-sizing: border-box;
}

/* Ensure the voting form is centered and clean */
.abvp-auth-container {
    max-width: 800px;
    width: 95%;
    margin: 0 auto; /* Consistent auto margins */
    padding: 15px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    text-align: center;
    border: 1px solid #e9ecef;
    position: relative; /* For proper positioning */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.abvp-logo {
    margin-bottom: 6px;
    text-align: center;
    width: 100%;
}

.abvp-logo img {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Fallback text for logo */
.abvp-logo-fallback {
    display: none;
    font-size: 24px;
    font-weight: bold;
    color: #dc2626;
    text-align: center;
    margin-bottom: 10px;
}

/* Show fallback if image fails to load */
.abvp-logo img[src*="error"] ~ .abvp-logo-fallback,
.abvp-logo img:not([src]) ~ .abvp-logo-fallback {
    display: block;
}

.abvp-copy {
    margin-bottom: 30px;
}

.abvp-copy h2 {
    color: #dc2626;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 15px 0;
}

.abvp-copy p {
    color: #333333;
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
}

.abvp-auth-form {
    width: 100%;
    max-width: 500px; /* Limit form width for better readability */
    margin: 0 auto;
}

.abvp-form {
    margin-bottom: 20px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.abvp-form-group {
    margin-bottom: 20px;
    text-align: left;
    width: 100%;
    max-width: 600px; /* Limit width for better readability */
}

.abvp-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #333333;
    font-weight: 500;
    font-size: 14px;
}

.abvp-form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    box-sizing: border-box;
}

.abvp-form-group input:focus {
    outline: none;
    border-color: #dc2626;
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

.abvp-submit-btn {
    width: 100%;
    padding: 14px 20px;
    background: #dc2626;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s ease;
}

.abvp-submit-btn:hover {
    background: #b91c1c;
}

.abvp-submit-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.abvp-submit-btn.loading {
    background: #999;
}

.abvp-message {
    padding: 15px 20px;
    border-radius: 8px;
    font-weight: 800;
    margin-top: 20px;
    font-size: 20px;
    text-align: center;
    display: block !important;
}

.abvp-message.success {
    background: rgba(73, 197, 177, 0.15);
    color: rgb(73, 197, 177);
    border: 2px solid rgba(73, 197, 177, 0.4);
}

/* Thank you page styling */
.abvp-thank-you-message {
    text-align: center;
    padding: 40px 20px;
}

.abvp-success-icon {
    font-size: 64px;
    color: #10b981;
    margin-bottom: 20px;
    font-weight: bold;
}

.abvp-thank-you-message h3 {
    color: #10b981;
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 20px;
}

.abvp-thank-you-message p {
    font-size: 18px;
    color: #374151;
    margin-bottom: 30px;
    line-height: 1.6;
}

.abvp-thank-you-instructions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    text-align: center;
}

.abvp-thank-you-instructions p {
    color: #666666;
    font-size: 14px;
    margin-bottom: 15px;
    line-height: 1.5;
}

.abvp-return-link {
    color: #dc2626;
    text-decoration: none;
    font-weight: 500;
    padding: 8px 16px;
    border: 1px solid #dc2626;
    border-radius: 6px;
    display: inline-block;
    transition: all 0.2s ease;
}

.abvp-return-link:hover {
    background: #dc2626;
    color: white;
    text-decoration: none;
}



.abvp-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 2px solid #f5c6cb;
}

.abvp-message.info {
    background: #d1ecf1;
    color: #0c5460;
    border: 2px solid #bee5eb;
}

/* Success page styles */
.abvp-auth-success {
    text-align: center;
}

.abvp-success-content h2 {
    color: #dc2626;
    font-size: 28px;
    font-weight: 600;
    margin: 0 0 20px 0;
}

.abvp-success-content p {
    color: #333333;
    font-size: 16px;
    line-height: 1.6;
    margin: 0 0 10px 0;
}

/* Responsive design */
@media (max-width: 768px) {
    /* Use flexbox for perfect centering */
    body {
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        margin: 0;
        padding: 20px;
        box-sizing: border-box;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }
    
    .abvp-auth-container {
        width: 100%;
        max-width: 100%;
        margin: 0; /* Remove auto margins on mobile */
        padding: 20px 15px;
        box-sizing: border-box;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }
    
    /* Ensure main content area doesn't interfere */
    .main-content,
    .site-main,
    .content-area {
        width: 100%;
        margin: 0;
        padding: 0;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        min-height: 100vh;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }
    
    .abvp-voting-content {
        padding: 10px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }
    
    .abvp-copy h2 {
        font-size: 24px;
    }
    
    .abvp-copy p {
        font-size: 14px;
        color: #333333;
    }
    
    .abvp-form-group input {
        font-size: 16px; /* Prevents zoom on iOS */
    }
}

/* Additional mobile optimizations */
@media (max-width: 480px) {
    .abvp-auth-container {
        padding: 20px 10px;
        border-radius: 8px;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }
    

    
    .abvp-voting-content {
        padding: 8px;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden; /* Prevent horizontal scrolling */
    }
    
    .abvp-copy h2 {
        font-size: 22px;
    }
    
    .abvp-copy p {
        font-size: 14px;
    }
    
    .abvp-section-image {
        margin: 15px 0;
    }
    
    .abvp-section-image img {
        max-width: 100%;
        height: auto;
    }
    
    /* Ensure all content fits within viewport */
    .abvp-question-section {
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    .abvp-rich-content {
        width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Loading animation */
.abvp-submit-btn.loading::after {
    content: '';
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s ease-in-out infinite;
    margin-left: 8px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Voting interface styles */
.abvp-voting-content {
    padding: 15px;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.abvp-voting-content h2 {
    color: #dc2626;
    margin-bottom: 2px;
    text-align: center;
}

.abvp-voting-content p {
    margin-bottom: 15px;
    color: #333333;
    text-align: center;
}

/* Enhanced voting question styles */
.abvp-question {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.abvp-vote-title {
    color: #dc2626;
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #dc2626;
}

.abvp-question-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e9ecef;
}

.abvp-question-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.abvp-question-section h4 {
    color: #dc2626;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
}

.abvp-question-section h4::before {
    content: '';
    width: 4px;
    height: 18px;
    background: #dc2626;
    margin-right: 10px;
    border-radius: 2px;
}

.abvp-question-section p {
    color: #333333;
    line-height: 1.6;
    margin: 0;
    text-align: left;
}

.abvp-rich-content {
    color: #333333;
    line-height: 1.6;
    text-align: left;
}

/* Ensure proper spacing for paragraphs */
.abvp-rich-content p {
    margin-bottom: 1em;
    margin-top: 0;
}

/* Ensure line breaks are preserved */
.abvp-rich-content br {
    display: block;
    content: "";
    margin-top: 0.5em;
}

/* Better mobile responsiveness for rich content */
@media (max-width: 768px) {
    .abvp-rich-content {
        line-height: 1.7;
        font-size: 16px;
    }
    
    .abvp-rich-content p {
        margin-bottom: 1.2em;
    }
}

/* Section image styling */
.abvp-section-image {
    margin: 20px 0;
    text-align: center;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.abvp-section-image img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

/* Enhanced image styling for rich content */
.abvp-rich-content img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
    display: block;
}

/* Prevent inline images from breaking layout */
.abvp-question-section img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 10px 0;
    display: block;
}

.abvp-rich-content ul,
.abvp-rich-content ol {
    margin: 10px 0;
    padding-left: 20px;
}

.abvp-rich-content li {
    margin-bottom: 5px;
}

.abvp-question-text {
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    background: #fff;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    margin: 0;
    box-sizing: border-box;
}

.abvp-no-questions {
    text-align: center;
    padding: 40px 20px;
    color: #333333;
}

.abvp-question {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 600px; /* Limit width for better readability */
    box-sizing: border-box;
}

.abvp-question h3 {
    color: #dc2626;
    margin-bottom: 15px;
    font-size: 18px;
}

.abvp-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}

.abvp-option {
    display: flex;
    align-items: center;
    padding: 12px;
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.abvp-option:hover {
    border-color: #dc2626;
    background: #f8f9fa;
}

.abvp-option input[type="radio"] {
    margin-right: 12px;
    transform: scale(1.2);
}

.abvp-option input[type="radio"]:checked + .abvp-option-text {
    font-weight: 600;
    color: #dc2626;
}

.abvp-option:has(input[type="radio"]:checked) {
    border-color: #dc2626;
    background: #fef2f2;
    box-shadow: 0 2px 8px rgba(220, 38, 38, 0.2);
}

.abvp-option-text {
    flex: 1;
    color: #333333;
}

.abvp-submit-section {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
    width: 100%;
    max-width: 600px; /* Match the form width */
}

.abvp-submit-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s ease;
}

.abvp-submit-btn:hover {
    background: #b91c1c;
}

.abvp-logout-section {
    text-align: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.abvp-logout-btn {
    color: #dc2626;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s ease;
}

.abvp-logout-btn:hover {
    color: #b91c1c;
    text-decoration: underline;
}

/* Timezone display styles */
.abvp-timezone-times {
    margin-top: 15px;
}

.abvp-timezone-times p {
    margin: 8px 0;
    color: #333333;
    font-size: 15px;
    line-height: 1.4;
}

.abvp-timezone-times strong {
    color: #dc2626;
    font-weight: 600;
}

/* Already voted styling */
.abvp-already-voted {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    margin-top: 20px;
}

.abvp-status-icon {
    font-size: 64px;
    color: #10b981;
    margin-bottom: 20px;
    font-weight: bold;
}

.abvp-already-voted h3 {
    color: #10b981;
    font-size: 28px;
    font-weight: 600;
    margin-bottom: 20px;
}

.abvp-already-voted p {
    font-size: 16px;
    color: #374151;
    margin-bottom: 15px;
    line-height: 1.6;
}

.abvp-additional-info {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e9ecef;
}

.abvp-additional-info p {
    color: #666666;
    font-size: 14px;
    font-style: italic;
    margin: 0;
}

/* Responsive design for already voted */
@media (max-width: 768px) {
    .abvp-already-voted {
        padding: 30px 15px;
    }
    
    .abvp-status-icon {
        font-size: 48px;
    }
    
    .abvp-already-voted h3 {
        font-size: 24px;
    }
    
    .abvp-already-voted p {
        font-size: 15px;
    }
} 

/* Enhanced error message styling for mobile */
.abvp-message.error {
    position: relative !important;
    z-index: 1000 !important;
    background: #fee2e2 !important;
    border: 2px solid #dc2626 !important;
    color: #991b1b !important;
    padding: 15px !important;
    margin: 20px 0 !important;
    border-radius: 8px !important;
    font-weight: bold !important;
    text-align: center !important;
    box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3) !important;
}

/* Mobile-specific error message improvements */
@media (max-width: 768px) {
    .abvp-message.error {
        margin: 15px 10px !important;
        padding: 20px 15px !important;
        font-size: 16px !important;
        line-height: 1.4 !important;
    }
    
    /* Ensure error message is always visible */
    #abvp-vote-message.error {
        position: sticky !important;
        top: 0 !important;
        margin: 0 0 20px 0 !important;
        border-radius: 0 !important;
    }
}

/* Nuclear option - force errors to be visible at all costs */
.abvp-error-message {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: #dc2626 !important;
    color: white !important;
    padding: 15px !important;
    margin: 15px 0 !important;
    font-size: 16px !important;
    font-weight: bold !important;
    text-align: center !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5) !important;
    /* Force positioning */
    position: relative !important;
    z-index: 999999 !important;
    /* Prevent hiding */
    clip: auto !important;
    overflow: visible !important;
    max-height: none !important;
    max-width: none !important;
}

/* Question error styling */
.abvp-question.has-error {
    border: 3px solid #dc2626 !important;
    background: #fef2f2 !important;
    border-radius: 8px !important;
    padding: 15px !important;
    margin: 20px 0 !important;
    position: relative !important;
}

/* Error container visibility */
.abvp-error-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    position: relative !important;
    margin: 15px 0 !important;
}

/* Mobile-specific error improvements */
@media (max-width: 768px) {
    .abvp-error-message {
        font-size: 18px !important;
        padding: 20px 15px !important;
        margin: 20px 0 !important;
        /* Full width on mobile */
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .abvp-question.has-error {
        padding: 20px 15px !important;
        margin: 25px 0 !important;
    }
    
    /* Ensure error container is always visible on mobile */
    .abvp-error-container {
        margin: 20px 0 !important;
        padding: 0 !important;
    }
}

/* Visual feedback for validation errors */
.validation-error .abvp-options {
    border: 2px solid #fca5a5 !important;
    background: #fef2f2 !important;
    border-radius: 8px !important;
    padding: 10px !important;
}

.required-highlight {
    animation: pulse-error 2s infinite;
}

@keyframes pulse-error {
    0%, 100% { border-color: #fca5a5; }
    50% { border-color: #dc2626; }
}

/* Touch feedback for mobile */
.abvp-option.touch-active {
    background-color: #f3f4f6 !important;
    transform: scale(0.98);
    transition: all 0.1s ease;
}

/* Ensure form validation works on mobile */
@media (max-width: 768px) {
    .abvp-voting-form {
        touch-action: manipulation;
    }
    
    .abvp-option input[type="radio"] {
        width: 20px;
        height: 20px;
        min-width: 20px;
        min-height: 20px;
        /* Keep 44px touch target for accessibility */
        padding: 12px;
        margin: -12px;
    }
    
    .abvp-option label {
        min-height: 44px;
        display: flex;
        align-items: center;
        padding: 12px;
    }
} 

/* Desktop radio button sizing */
.abvp-option input[type="radio"] {
    width: 16px;
    height: 16px;
    min-width: 16px;
    min-height: 16px;
    margin: 0;
    padding: 0;
    flex-shrink: 0;
} 

/* iOS Safari specific error visibility rules */
@supports (-webkit-touch-callout: none) {
    .abvp-error-message {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        /* iOS-specific properties */
        -webkit-appearance: none !important;
        -webkit-tap-highlight-color: transparent !important;
        /* Force iOS to render */
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
        /* Prevent iOS hiding */
        -webkit-overflow-scrolling: touch !important;
        /* Force visibility */
        position: relative !important;
        z-index: 999999 !important;
    }
    
    .abvp-error-container {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        /* iOS viewport fix */
        position: relative !important;
        z-index: 999999 !important;
        /* Force iOS to render */
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
    }
    
    .abvp-question.has-error {
        /* iOS-specific error styling */
        border: 3px solid #dc2626 !important;
        background: #fef2f2 !important;
        /* Force iOS to render */
        -webkit-transform: translateZ(0) !important;
        transform: translateZ(0) !important;
    }
} 