/**
 * MCQ Button Styles
 * Date: 14 July 2025
 * Account: DDL
 * 
 * Beautiful, touch-friendly button styles for multiple-choice questionnaire
 * Optimized for both desktop and mobile use with Real Minds AI branding
 */

/* ============================================
   Base Button Styles - Mobile First Approach
   ============================================ */

.mcq-answer-button {
    /* Layout & Sizing */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 56px; /* Touch-friendly target size */
    padding: 1rem 1.5rem;
    
    /* Typography */
    font-family: var(--font-family);
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    
    /* Colors & Background */
    background-color: var(--white);
    color: var(--body-color);
    
    /* Borders & Shape */
    border: 2px solid var(--border-color);
    border-radius: 12px;
    
    /* Interactions */
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    
    /* Transitions */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Prevent text selection on touch */
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    
    /* Position for ripple effect */
    position: relative;
    overflow: hidden;
}

/* ============================================
   Mobile-First Responsive Design
   ============================================ */

/* Base mobile styles (320px - 767px) */
@media (max-width: 767.98px) {
    .mcq-answer-button {
        width: 100%;
        min-height: 56px; /* Increased for better touch targets */
        padding: 1rem;
        font-size: 1rem;
        margin-bottom: 0.75rem;
    }
    
    .mcq-answer-button:last-child {
        margin-bottom: 0;
    }
    
    /* Ensure full-width on small screens */
    .mcq-option {
        width: 100%;
        margin: 0;
        padding: 0;
    }
    
    /* Adjust text for mobile readability */
    .mcq-answer-text {
        font-size: 0.9375rem;
        line-height: 1.5;
    }
}

/* Small phones (320px - 374px) */
@media (max-width: 374px) {
    .mcq-answer-button {
        padding: 0.875rem;
        font-size: 0.9375rem;
    }
    
    .mcq-answer-text {
        font-size: 0.875rem;
    }
}

/* Tablet styles (768px - 1023px) */
@media (min-width: 768px) and (max-width: 1023.98px) {
    .mcq-answer-button {
        min-height: 52px;
        padding: 1rem 1.25rem;
    }
}

/* ============================================
   Touch Device Optimizations
   ============================================ */

/* Touch devices */
@media (hover: none) and (pointer: coarse) {
    .mcq-answer-button {
        /* Remove hover effects on touch devices */
        transition: transform 0.1s ease, background-color 0.2s ease;
    }
    
    .mcq-answer-button:hover {
        transform: none;
        box-shadow: 0 2px 8px rgba(26, 27, 37, 0.08);
    }
    
    /* Active state for touch feedback */
    .mcq-answer-button:active {
        transform: scale(0.98);
        transition-duration: 0.05s;
    }
    
    /* Disable hover background effect on touch */
    .mcq-answer-button::before {
        display: none;
    }
}

/* ============================================
   iOS-Specific Optimizations
   ============================================ */

@supports (-webkit-touch-callout: none) {
    /* iOS Safari specific styles */
    .mcq-answer-button {
        /* Prevent text selection on long press */
        -webkit-touch-callout: none;
        /* Smooth transform animations */
        -webkit-transform: translateZ(0);
        transform: translateZ(0);
    }
    
    /* Fix iOS tap delay */
    .mcq-answer-button {
        cursor: pointer;
    }
}

/* ============================================
   Android-Specific Optimizations
   ============================================ */

@media screen and (-webkit-min-device-pixel-ratio: 0) {
    /* Android Chrome specific styles */
    .mcq-answer-button {
        /* Remove tap highlight */
        -webkit-tap-highlight-color: transparent;
    }
}

/* ============================================
   Enhanced Accessibility
   ============================================ */

/* Keyboard navigation */
.mcq-answer-button:focus {
    outline: none;
}

.mcq-answer-button:focus-visible {
    outline: 3px solid #005FCC;
    outline-offset: 2px;
    box-shadow: 0 0 0 5px rgba(0, 95, 204, 0.3);
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .mcq-answer-button {
        border-width: 3px;
        border-color: currentColor;
    }
    
    .mcq-answer-button.selected {
        outline: 3px solid currentColor;
        outline-offset: 2px;
        background: currentColor;
        color: white;
    }
    
    .mcq-answer-button:hover {
        border-color: currentColor;
    }
}

/* Screen reader announcements */
.mcq-answer-button[aria-pressed="true"]::after {
    content: " (Selected)";
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* ============================================
   Performance Optimizations
   ============================================ */

/* Optimize animations for 60fps */
.mcq-answer-button {
    /* Use transform for animations instead of position */
    transform: translateY(0);
    /* Enable GPU acceleration */
    will-change: transform;
}

/* Remove will-change after animation */
.mcq-answer-button:not(:hover) {
    will-change: auto;
}

/* ============================================
   Cross-Browser Support
   ============================================ */

/* Firefox */
@-moz-document url-prefix() {
    .mcq-answer-button::-moz-focus-inner {
        border: 0;
        padding: 0;
    }
}

/* Edge */
@supports (-ms-ime-align: auto) {
    .mcq-answer-button {
        /* Edge-specific fixes if needed */
    }
}

/* Safari */
@media not all and (min-resolution: .001dpcm) {
    @supports (-webkit-appearance: none) {
        .mcq-answer-button {
            -webkit-appearance: none;
        }
    }
}

/* ============================================
   Hover State
   ============================================ */

.mcq-answer-button:hover {
    /* Upward translation for hover feedback */
    transform: translateY(-2px);
    
    /* Box shadow with purple tint */
    box-shadow: 0 4px 16px rgba(167, 122, 205, 0.2),
                0 2px 8px rgba(167, 122, 205, 0.1);
    
    /* Border color change to accent */
    border-color: var(--accent-color);
    
    /* Subtle background change */
    background-color: rgba(167, 122, 205, 0.03);
}

/* ============================================
   Selected/Checked State
   ============================================ */

.mcq-answer-button.selected,
.mcq-answer-button[aria-checked="true"],
input[type="radio"]:checked + .mcq-answer-button {
    /* Purple gradient background */
    background: linear-gradient(135deg, #A77ACD 0%, #9A6BC5 100%);
    
    /* White text for contrast */
    color: var(--white);
    
    /* Stronger border */
    border-color: #9A6BC5;
    
    /* Slightly bolder font */
    font-weight: 600;
    
    /* Enhanced shadow for selected state */
    box-shadow: 0 4px 20px rgba(167, 122, 205, 0.3),
                0 2px 10px rgba(167, 122, 205, 0.2);
}

/* Hover on selected state */
.mcq-answer-button.selected:hover,
.mcq-answer-button[aria-checked="true"]:hover,
input[type="radio"]:checked + .mcq-answer-button:hover {
    /* Darker gradient on hover */
    background: linear-gradient(135deg, #9A6BC5 0%, #8B5BB6 100%);
    
    /* Slightly more elevation */
    transform: translateY(-3px);
    
    /* Enhanced shadow */
    box-shadow: 0 6px 24px rgba(167, 122, 205, 0.4),
                0 3px 12px rgba(167, 122, 205, 0.3);
}

/* ============================================
   Active/Pressed State (Touch Feedback)
   ============================================ */

.mcq-answer-button:active {
    /* Press down effect */
    transform: translateY(0);
    
    /* Reduced shadow for pressed feel */
    box-shadow: 0 1px 4px rgba(167, 122, 205, 0.2);
    
    /* Slightly darker background */
    background-color: rgba(167, 122, 205, 0.08);
}

.mcq-answer-button.selected:active,
.mcq-answer-button[aria-checked="true"]:active,
input[type="radio"]:checked + .mcq-answer-button:active {
    /* Maintain gradient but slightly darker */
    background: linear-gradient(135deg, #8B5BB6 0%, #7C4CA7 100%);
}

/* ============================================
   Ripple Effect
   ============================================ */

.mcq-answer-button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(167, 122, 205, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

/* Trigger ripple on click */
.mcq-answer-button:active::before {
    width: 300px;
    height: 300px;
}

/* White ripple for selected buttons */
.mcq-answer-button.selected::before,
.mcq-answer-button[aria-checked="true"]::before,
input[type="radio"]:checked + .mcq-answer-button::before {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   Focus State (Accessibility)
   ============================================ */

.mcq-answer-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(167, 122, 205, 0.4);
}

.mcq-answer-button:focus:not(:focus-visible) {
    box-shadow: none;
}

.mcq-answer-button:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}

/* ============================================
   Disabled State
   ============================================ */

.mcq-answer-button:disabled,
.mcq-answer-button[aria-disabled="true"] {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.mcq-answer-button:disabled:hover,
.mcq-answer-button[aria-disabled="true"]:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-color);
    background-color: var(--white);
}

/* ============================================
   Icon Support
   ============================================ */

.mcq-answer-button i,
.mcq-answer-button svg {
    margin-right: 0.5rem;
    font-size: 1.2rem;
    vertical-align: middle;
}

.mcq-answer-button.icon-right i,
.mcq-answer-button.icon-right svg {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* ============================================
   Button Variants
   ============================================ */

/* Compact variant for multiple columns */
.mcq-answer-button.compact {
    min-height: 48px;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
}

/* Large variant for important choices */
.mcq-answer-button.large {
    min-height: 64px;
    padding: 1.25rem 2rem;
    font-size: 1.1rem;
    border-radius: 16px;
}

/* ============================================
   Animation Classes
   ============================================ */

/* Pulse animation for drawing attention */
@keyframes mcq-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(167, 122, 205, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(167, 122, 205, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(167, 122, 205, 0);
    }
}

.mcq-answer-button.pulse {
    animation: mcq-pulse 2s infinite;
}

/* Shake animation for error feedback */
@keyframes mcq-shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}

.mcq-answer-button.error {
    animation: mcq-shake 0.5s;
    border-color: var(--danger-color);
}

/* ============================================
   Container Layout
   ============================================ */

/* Button container for proper spacing */
.mcq-button-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

/* ============================================
   Media Queries - Tablet and Desktop
   ============================================ */

@media (min-width: 768px) {
    /* Adjust button styling for larger screens */
    .mcq-answer-button {
        /* Add max-width for elegant appearance on desktop */
        max-width: 600px;
        margin: 0 auto;
        
        /* Slightly larger text on desktop */
        font-size: 1.05rem;
        
        /* More padding on sides */
        padding: 1rem 2rem;
    }
    
    /* Button container can use grid on larger screens */
    .mcq-button-container.grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .mcq-button-container.grid .mcq-answer-button {
        max-width: none;
    }
    
    /* Hover effects can be stronger on desktop */
    .mcq-answer-button:hover {
        transform: translateY(-3px);
        box-shadow: 0 6px 20px rgba(167, 122, 205, 0.25),
                    0 3px 10px rgba(167, 122, 205, 0.15);
    }
}

@media (min-width: 992px) {
    /* Even more refined spacing on large screens */
    .mcq-answer-button {
        max-width: 700px;
    }
    
    /* Three column grid option */
    .mcq-button-container.grid-3 {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* ============================================
   High Contrast Mode Support
   ============================================ */

@media (prefers-contrast: high) {
    .mcq-answer-button {
        border-width: 3px;
    }
    
    .mcq-answer-button:focus-visible {
        outline-width: 3px;
    }
}

/* ============================================
   Reduced Motion Support
   ============================================ */

@media (prefers-reduced-motion: reduce) {
    .mcq-answer-button {
        transition: none;
    }
    
    .mcq-answer-button::before {
        transition: none;
    }
    
    .mcq-answer-button.pulse {
        animation: none;
    }
}

/* ============================================
   Dark Mode Support (if implemented)
   ============================================ */

@media (prefers-color-scheme: dark) {
    .mcq-answer-button {
        background-color: var(--slate-black);
        color: var(--white);
        border-color: var(--slate-grey);
    }
    
    .mcq-answer-button:hover {
        background-color: var(--body-color);
        border-color: var(--accent-color);
    }
}

/* ============================================
   Print Styles
   ============================================ */

@media print {
    .mcq-answer-button {
        border: 1px solid #000;
        box-shadow: none;
        min-height: auto;
        padding: 0.5rem 1rem;
    }
}
