/* Glassy Minimalist Voter Page Styles */

:root {
    /* Brand Colors */
    --red-primary: #DA291C;
    --red-hover: #B31F16;
    --red-light: #FFE8E6;
    
    /* Background & Surfaces */
    --bg: #F5F7FA;
    --surface: rgba(255, 255, 255, 0.7);
    --surface-hover: rgba(255, 255, 255, 0.85);
    --surface-selected: rgba(218, 41, 28, 0.08);
    
    /* Text Colors */
    --text-primary: #1A1A1A;
    --text-secondary: #4A5568;
    --text-muted: #718096;
    --text-inverse: #FFFFFF;
    
    /* State Colors */
    --success: #10B981;
    --success-light: #D1FAE5;
    --error: #EF4444;
    --error-light: #FEE2E2;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    /* Border */
    --border-color: rgba(0, 0, 0, 0.08);
    --border-radius: 16px;
    --border-radius-sm: 12px;
    
    /* Spacing */
    --max-width: 720px;
    --spacing-unit: 8px;
}

/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-primary);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* App Container */
.app-container {
    min-height: 100vh;
    padding: calc(var(--spacing-unit) * 2);
    display: flex;
    flex-direction: column;
}

/* Header */
.app-header {
    text-align: center;
    margin-bottom: calc(var(--spacing-unit) * 4);
    animation: fadeInDown 0.6s ease-out;
}

.app-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-inverse);
    margin-bottom: calc(var(--spacing-unit) * 1);
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 400;
}

/* Main Content */
.main-content {
    flex: 1;
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
}

/* Skeleton Loaders */
.loading-container {
    max-width: var(--max-width);
    width: 100%;
    margin: 0 auto;
}

.skeleton-header {
    height: 80px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: var(--border-radius);
    margin-bottom: calc(var(--spacing-unit) * 4);
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 3);
    border: 1px solid var(--border-color);
    animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-image {
    width: 80px;
    height: 80px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    margin: 0 auto calc(var(--spacing-unit) * 2);
}

.skeleton-title {
    height: 24px;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
    margin-bottom: calc(var(--spacing-unit) * 1);
    width: 60%;
    margin-left: auto;
    margin-right: auto;
}

.skeleton-description {
    height: 16px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    width: 80%;
    margin: 0 auto;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Candidates Grid */
.candidates-grid {
    display: grid;
    gap: calc(var(--spacing-unit) * 2);
    margin-bottom: calc(var(--spacing-unit) * 10);
}

/* Candidate Card - Glassy Effect */
.candidate-card {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    padding: calc(var(--spacing-unit) * 3);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.6s ease-out backwards;
}

.candidate-card:nth-child(1) { animation-delay: 0.1s; }
.candidate-card:nth-child(2) { animation-delay: 0.2s; }
.candidate-card:nth-child(3) { animation-delay: 0.3s; }
.candidate-card:nth-child(4) { animation-delay: 0.4s; }

.candidate-card:hover {
    background: var(--surface-hover);
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

.candidate-card:focus {
    outline: 3px solid var(--red-primary);
    outline-offset: 2px;
}

.candidate-card.selected {
    background: var(--surface-selected);
    border-color: var(--red-primary);
    box-shadow: 0 0 0 3px rgba(218, 41, 28, 0.1);
}

.card-inner {
    text-align: center;
    position: relative;
}

/* Candidate Image/Placeholder */
.candidate-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto calc(var(--spacing-unit) * 2);
    display: block;
    border: 3px solid rgba(255, 255, 255, 0.5);
}

.candidate-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--red-primary) 0%, var(--red-hover) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto calc(var(--spacing-unit) * 2);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-inverse);
}

/* Candidate Info */
.candidate-name {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: calc(var(--spacing-unit) * 1);
}

.candidate-description {
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* Selection Indicator */
.selection-indicator {
    position: absolute;
    top: calc(var(--spacing-unit) * 2);
    right: calc(var(--spacing-unit) * 2);
    color: var(--text-muted);
    transition: all 0.3s ease;
    opacity: 0.3;
}

.candidate-card.selected .selection-indicator {
    color: var(--red-primary);
    opacity: 1;
}

.selection-indicator .inner-circle {
    opacity: 0;
    transform: scale(0);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.candidate-card.selected .inner-circle {
    opacity: 1;
    transform: scale(1);
}

/* Error Container */
.error-container {
    background: var(--error-light);
    color: var(--error);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: var(--border-radius-sm);
    margin-top: calc(var(--spacing-unit) * 3);
    border-left: 4px solid var(--error);
    font-weight: 500;
    animation: slideInDown 0.3s ease-out;
}

/* Sticky Footer */
.sticky-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-color);
    padding: calc(var(--spacing-unit) * 2);
    box-shadow: var(--shadow-lg);
}

/* Submit Button */
.submit-button {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    display: block;
    background: var(--red-primary);
    color: var(--text-inverse);
    border: none;
    border-radius: var(--border-radius-sm);
    padding: calc(var(--spacing-unit) * 2);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.submit-button:hover:not(:disabled) {
    background: var(--red-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.submit-button:active:not(:disabled) {
    transform: translateY(0);
}

.submit-button:disabled {
    background: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

.submit-button:focus {
    outline: 3px solid rgba(218, 41, 28, 0.5);
    outline-offset: 2px;
}

/* Spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--text-inverse);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: calc(var(--spacing-unit) * 1);
}

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

/* Confirmation Screen */
.confirmation-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: calc(var(--spacing-unit) * 2);
}

.confirmation-content {
    background: var(--surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 5);
    text-align: center;
    max-width: 500px;
    border: 1px solid var(--border-color);
    animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.success-icon {
    color: var(--success);
    margin-bottom: calc(var(--spacing-unit) * 3);
    animation: checkmark 0.8s ease-out;
}

.confirmation-content h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: calc(var(--spacing-unit) * 2);
}

.confirmation-message {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: calc(var(--spacing-unit) * 3);
    line-height: 1.6;
}

.privacy-note {
    font-size: 0.875rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.03);
    padding: calc(var(--spacing-unit) * 2);
    border-radius: var(--border-radius-sm);
    border-left: 3px solid var(--success);
}

/* Mock Mode Indicator */
.mock-indicator {
    position: fixed;
    top: calc(var(--spacing-unit) * 2);
    right: calc(var(--spacing-unit) * 2);
    background: rgba(255, 193, 7, 0.9);
    color: var(--text-primary);
    padding: calc(var(--spacing-unit) * 1) calc(var(--spacing-unit) * 2);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: var(--shadow-md);
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes checkmark {
    0% {
        transform: scale(0) rotate(-45deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.2) rotate(0deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* Desktop Optimization */
@media (min-width: 640px) {
    .candidates-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
    
    .app-header h1 {
        font-size: 2.5rem;
    }
    
    .subtitle {
        font-size: 1.125rem;
    }
}

@media (min-width: 768px) {
    .app-container {
        padding: calc(var(--spacing-unit) * 4);
    }
    
    .sticky-footer {
        padding: calc(var(--spacing-unit) * 3) calc(var(--spacing-unit) * 4);
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .candidate-card {
        border-width: 2px;
    }
    
    .candidate-card.selected {
        border-width: 3px;
    }
}
