/**
 * Election System - Custom Styles
 * สไตล์เฉพาะสำหรับระบบเลือกตั้งนักศึกษา
 */

/* ===== CSS Variables ===== */
:root {
    --primary-50: #faf5ff;
    --primary-100: #f3e8ff;
    --primary-200: #e9d5ff;
    --primary-300: #d8b4fe;
    --primary-400: #c084fc;
    --primary-500: #a855f7;
    --primary-600: #9333ea;
    --primary-700: #7e22ce;
    --primary-800: #6b21a8;
    --primary-900: #581c87;
    
    --accent-50: #fdf4ff;
    --accent-100: #fae8ff;
    --accent-200: #f5d0fe;
    --accent-300: #f0abfc;
    --accent-400: #e879f9;
    --accent-500: #d946ef;
    --accent-600: #c026d3;
    --accent-700: #a21caf;
    --accent-800: #86198f;
    --accent-900: #701a75;
    
    --dark-50: #f8fafc;
    --dark-100: #f1f5f9;
    --dark-200: #e2e8f0;
    --dark-300: #cbd5e1;
    --dark-400: #94a3b8;
    --dark-500: #64748b;
    --dark-600: #475569;
    --dark-700: #334155;
    --dark-800: #1e293b;
    --dark-900: #0f172a;
    
    --font-thai: 'Kanit', sans-serif;
    --font-english: 'Plus Jakarta Sans', sans-serif;
}

/* ===== Base Styles ===== */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-thai);
    background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 50%, #fdf4ff 100%);
    min-height: 100vh;
}

/* English text */
.font-en,
code,
pre,
input[type="email"],
input[type="password"],
input[type="number"] {
    font-family: var(--font-english);
}

/* ===== Glass Morphism ===== */
.glass {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5);
    box-shadow: 
        0 8px 32px rgba(168, 85, 247, 0.1),
        0 0 0 1px rgba(168, 85, 247, 0.05);
}

.glass-dark {
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== Gradient Buttons ===== */
.btn-gradient {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--accent-600) 100%);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-gradient::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--accent-700) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn-gradient:hover::before {
    opacity: 1;
}

.btn-gradient > * {
    position: relative;
    z-index: 1;
}

/* ===== Card Hover Effects ===== */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
    box-shadow: 
        0 20px 40px rgba(168, 85, 247, 0.15),
        0 0 0 1px rgba(168, 85, 247, 0.1);
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

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

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

@keyframes bounce {
    0%, 100% {
        transform: translateY(-5%);
        animation-timing-function: cubic-bezier(0.8, 0, 1, 1);
    }
    50% {
        transform: translateY(0);
        animation-timing-function: cubic-bezier(0, 0, 0.2, 1);
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Animation Classes */
.animate-fade-in {
    animation: fadeIn 0.5s ease forwards;
}

.animate-fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.animate-fade-in-down {
    animation: fadeInDown 0.6s ease forwards;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease forwards;
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease forwards;
}

.animate-scale-in {
    animation: scaleIn 0.4s ease forwards;
}

.animate-pulse {
    animation: pulse 2s ease-in-out infinite;
}

.animate-spin {
    animation: spin 1s linear infinite;
}

.animate-bounce {
    animation: bounce 1s ease-in-out infinite;
}

.animate-float {
    animation: float 3s ease-in-out infinite;
}

/* Staggered Animation Delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* ===== Form Styles ===== */
input:focus,
select:focus,
textarea:focus {
    outline: none;
}

input[type="checkbox"],
input[type="radio"] {
    accent-color: var(--primary-500);
}

/* Custom Checkbox */
.custom-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid var(--dark-300);
    border-radius: 0.375rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-checkbox:checked {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--accent-600) 100%);
    border-color: transparent;
}

.custom-checkbox:checked::after {
    content: '✓';
    display: block;
    text-align: center;
    color: white;
    font-size: 0.75rem;
    line-height: 1.25rem;
}

/* Custom Radio */
.custom-radio {
    appearance: none;
    -webkit-appearance: none;
    width: 1.5rem;
    height: 1.5rem;
    border: 2px solid var(--dark-300);
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.custom-radio:checked {
    border-color: var(--primary-500);
    border-width: 6px;
}

/* ===== Candidate Card ===== */
.candidate-card {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.candidate-card:hover {
    transform: translateY(-8px) scale(1.02);
}

.candidate-card .candidate-number {
    transition: all 0.3s ease;
}

.candidate-card:hover .candidate-number {
    transform: scale(1.1);
}

/* ===== Vote Card ===== */
.vote-card {
    cursor: pointer;
    transition: all 0.3s ease;
}

.vote-card:hover {
    border-color: var(--primary-300);
    background: var(--primary-50);
}

.vote-card.selected {
    border-color: var(--primary-500);
    background: linear-gradient(135deg, var(--primary-50) 0%, var(--accent-50) 100%);
    box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.2);
}

.vote-card.selected .vote-check {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--accent-600) 100%);
    color: white;
}

/* ===== Stats Counter ===== */
.stats-counter {
    font-feature-settings: 'tnum' on, 'lnum' on;
    font-variant-numeric: tabular-nums;
}

/* ===== Progress Bar ===== */
.progress-bar {
    height: 8px;
    border-radius: 4px;
    background: var(--dark-200);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, var(--primary-500) 0%, var(--accent-500) 100%);
    transition: width 0.5s ease;
}

/* ===== Loading Skeleton ===== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--dark-100) 25%,
        var(--dark-50) 50%,
        var(--dark-100) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

/* ===== Tooltip ===== */
.tooltip {
    position: relative;
}

.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    padding: 0.5rem 0.75rem;
    background: var(--dark-800);
    color: white;
    font-size: 0.75rem;
    border-radius: 0.5rem;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
    z-index: 100;
}

.tooltip:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-4px);
}

/* ===== Badge ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 9999px;
}

.badge-success {
    background: rgba(16, 185, 129, 0.1);
    color: #059669;
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    color: #d97706;
}

.badge-danger {
    background: rgba(239, 68, 68, 0.1);
    color: #dc2626;
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    color: #2563eb;
}

/* ===== Modal ===== */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-backdrop.active {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    background: white;
    border-radius: 1.5rem;
    padding: 1.5rem;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.95) translateY(20px);
    transition: all 0.3s ease;
}

.modal-backdrop.active .modal-content {
    transform: scale(1) translateY(0);
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--dark-100);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--dark-300);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--dark-400);
}

/* ===== Background Decorations ===== */
.bg-decoration {
    position: fixed;
    pointer-events: none;
    z-index: -1;
}

.bg-decoration-1 {
    top: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.1) 0%, transparent 70%);
}

.bg-decoration-2 {
    bottom: -10%;
    left: -10%;
    width: 40vw;
    height: 40vw;
    background: radial-gradient(circle, rgba(217, 70, 239, 0.1) 0%, transparent 70%);
}

.bg-decoration-3 {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(192, 38, 211, 0.05) 0%, transparent 70%);
}

/* ===== Navigation Active State ===== */
.nav-link {
    position: relative;
    transition: all 0.3s ease;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--primary-500), var(--accent-500));
    border-radius: 1px;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

/* ===== Table Styles ===== */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.table-hover tbody tr {
    transition: background-color 0.2s ease;
}

.table-hover tbody tr:hover {
    background-color: var(--dark-50);
}

/* ===== Print Styles ===== */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white;
    }
    
    .glass {
        background: white;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}

/* ===== Dark Mode Support (Optional) ===== */
@media (prefers-color-scheme: dark) {
    /* Uncomment to enable dark mode
    body {
        background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
    }
    
    .glass {
        background: rgba(30, 41, 59, 0.85);
        border-color: rgba(255, 255, 255, 0.1);
    }
    */
}

/* ===== Responsive Utilities ===== */
@media (max-width: 640px) {
    .container {
        padding-left: 1rem;
        padding-right: 1rem;
    }
    
    .hide-mobile {
        display: none !important;
    }
}

@media (min-width: 641px) {
    .hide-desktop {
        display: none !important;
    }
}

/* ===== Accessibility ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

:focus-visible {
    outline: 2px solid var(--primary-500);
    outline-offset: 2px;
}

/* ===== Selection ===== */
::selection {
    background: rgba(168, 85, 247, 0.3);
    color: var(--dark-900);
}

/* ===== Hero Section ===== */
.hero-gradient {
    background: linear-gradient(135deg, 
        rgba(168, 85, 247, 0.1) 0%, 
        rgba(217, 70, 239, 0.1) 50%, 
        rgba(192, 38, 211, 0.1) 100%
    );
}

/* ===== Feature Icons ===== */
.feature-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
}

.feature-icon-primary {
    background: linear-gradient(135deg, var(--primary-100) 0%, var(--primary-50) 100%);
    color: var(--primary-600);
}

.feature-icon-accent {
    background: linear-gradient(135deg, var(--accent-100) 0%, var(--accent-50) 100%);
    color: var(--accent-600);
}

.feature-card:hover .feature-icon {
    transform: scale(1.1) rotate(-5deg);
}

/* ===== Countdown Timer ===== */
.countdown-item {
    text-align: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 0.75rem;
    min-width: 4rem;
}

.countdown-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--accent-600) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.countdown-label {
    font-size: 0.625rem;
    color: var(--dark-500);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

