/**
 * Hệ thống bình chọn danh hiệu cuối năm
 * Main Stylesheet
 */

/* ===== ROOT VARIABLES ===== */
:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --primary-light: #818cf8;
    --secondary: #f59e0b;
    --secondary-dark: #d97706;
    --accent: #ec4899;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;
    
    --bg-dark: #0f0f23;
    --bg-card: #1a1a2e;
    --bg-card-hover: #252542;
    --bg-gradient: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    
    --text-primary: #ffffff;
    --text-secondary: #a5b4fc;
    --text-muted: #6b7280;
    
    --border-color: rgba(99, 102, 241, 0.3);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
    --shadow-card: 0 10px 40px rgba(0, 0, 0, 0.4);
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-gradient);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--primary-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }

a {
    color: var(--primary-light);
    text-decoration: none;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--secondary);
}

/* ===== LAYOUT ===== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.main-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER ===== */
.header {
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 15px 0;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logo-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 1.3rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links {
    display: flex;
    gap: 10px;
}

.nav-link {
    padding: 10px 20px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.nav-link:hover, .nav-link.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text-primary);
}

.nav-link::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: var(--primary);
    transition: var(--transition-normal);
    transform: translateX(-50%);
}

.nav-link:hover::before, .nav-link.active::before {
    width: 60%;
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-normal);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: var(--transition-slow);
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(99, 102, 241, 0.5);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #059669 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.4);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #dc2626 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.4);
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--primary);
    color: var(--primary-light);
}

.btn-outline:hover {
    background: var(--primary);
    color: white;
}

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 0.875rem;
}

.btn-block {
    width: 100%;
}

/* ===== CARDS ===== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 25px;
    transition: var(--transition-normal);
    position: relative;
    overflow: hidden;
}

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

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-card);
    border-color: var(--primary);
}

.card-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-color);
}

.card-title {
    font-size: 1.3rem;
    margin-bottom: 5px;
}

.card-body {
    flex-grow: 1;
}

/* ===== CANDIDATE CARD ===== */
.candidate-card {
    text-align: center;
    padding: 30px 20px;
    cursor: pointer;
}

.candidate-card.selected {
    border-color: var(--success);
    background: rgba(16, 185, 129, 0.1);
    box-shadow: 0 0 30px rgba(16, 185, 129, 0.3);
}

.candidate-card.selected::before {
    background: var(--success);
}

.candidate-avatar {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 20px;
    object-fit: cover;
    border: 4px solid var(--border-color);
    transition: var(--transition-normal);
    box-shadow: 0 0 30px rgba(99, 102, 241, 0.2);
}

.candidate-card:hover .candidate-avatar,
.candidate-card.selected .candidate-avatar {
    border-color: var(--primary);
    transform: scale(1.05);
    box-shadow: 0 0 40px rgba(99, 102, 241, 0.4);
}

.candidate-name {
    font-size: 1.25rem;
    margin-bottom: 5px;
}

.candidate-position {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.candidate-department {
    display: inline-block;
    padding: 5px 12px;
    background: rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--primary-light);
}

.candidate-check {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--success);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0);
    transition: var(--transition-normal);
}

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

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition-normal);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.form-control::placeholder {
    color: var(--text-muted);
}

textarea.form-control {
    min-height: 120px;
    resize: vertical;
}

/* ===== GRID ===== */
.grid {
    display: grid;
    gap: 25px;
}

.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 992px) {
    .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ===== HERO SECTION ===== */
.hero {
    padding: 80px 0;
    text-align: center;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.2) 0%, transparent 70%);
    pointer-events: none;
}

.hero-title {
    font-size: 3rem;
    margin-bottom: 20px;
    animation: fadeInUp 0.8s ease;
}

.hero-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
    animation: fadeInUp 0.8s ease 0.2s both;
}

/* ===== CATEGORY SECTION ===== */
.category-header {
    text-align: center;
    margin-bottom: 40px;
}

.category-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin: 0 auto 20px;
    box-shadow: 0 10px 40px rgba(245, 158, 11, 0.3);
}

.category-title {
    font-size: 2rem;
    margin-bottom: 10px;
}

.category-desc {
    color: var(--text-secondary);
}

/* ===== VOTING STATUS ===== */
.voting-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px 30px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--success);
    border-radius: var(--radius-lg);
    margin-bottom: 30px;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* ===== PROGRESS BAR ===== */
.progress-container {
    margin: 20px 0;
}

.progress-bar {
    height: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--accent) 100%);
    border-radius: 6px;
    transition: width 1s ease;
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-label {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* ===== RESULTS ===== */
.result-card {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 20px;
    margin-bottom: 15px;
}

.result-rank {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--accent) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    font-weight: 700;
    flex-shrink: 0;
}

.result-rank.gold { background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); }
.result-rank.silver { background: linear-gradient(135deg, #9ca3af 0%, #6b7280 100%); }
.result-rank.bronze { background: linear-gradient(135deg, #d97706 0%, #b45309 100%); }

.result-avatar {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--border-color);
}

.result-info {
    flex-grow: 1;
}

.result-name {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

.result-votes {
    display: flex;
    align-items: center;
    gap: 15px;
}

.result-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-light);
}

.result-count {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-normal);
}

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

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    transform: scale(0.9) translateY(20px);
    transition: var(--transition-normal);
}

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

.modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border: none;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition-fast);
}

.modal-close:hover {
    background: var(--danger);
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

.animate-fadeIn { animation: fadeIn 0.5s ease; }
.animate-fadeInUp { animation: fadeInUp 0.5s ease; }
.animate-slideIn { animation: slideIn 0.5s ease; }
.animate-scaleIn { animation: scaleIn 0.5s ease; }

/* ===== ADMIN STYLES ===== */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 280px;
    background: var(--bg-card);
    border-right: 1px solid var(--border-color);
    padding: 20px;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.admin-content {
    flex-grow: 1;
    margin-left: 280px;
    padding: 30px;
}

.sidebar-menu {
    list-style: none;
    margin-top: 30px;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: var(--transition-fast);
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background: rgba(99, 102, 241, 0.2);
    color: var(--text-primary);
}

.sidebar-menu a.active {
    border-left: 3px solid var(--primary);
}

/* ===== TABLE ===== */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th,
.data-table td {
    padding: 15px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.data-table th {
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.02);
}

.data-table .avatar-sm {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.badge-danger { background: rgba(239, 68, 68, 0.2); color: var(--danger); }
.badge-info { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.badge-primary { background: rgba(99, 102, 241, 0.2); color: var(--primary-light); }

/* ===== ALERTS ===== */
.alert {
    padding: 15px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.alert-success { background: rgba(16, 185, 129, 0.1); border: 1px solid var(--success); color: var(--success); }
.alert-error { background: rgba(239, 68, 68, 0.1); border: 1px solid var(--danger); color: var(--danger); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border: 1px solid var(--warning); color: var(--warning); }
.alert-info { background: rgba(59, 130, 246, 0.1); border: 1px solid var(--info); color: var(--info); }

/* ===== STATS CARDS ===== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    padding: 25px;
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.1) 0%, transparent 70%);
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 15px;
}

.stat-icon.blue { background: rgba(59, 130, 246, 0.2); color: var(--info); }
.stat-icon.green { background: rgba(16, 185, 129, 0.2); color: var(--success); }
.stat-icon.yellow { background: rgba(245, 158, 11, 0.2); color: var(--warning); }
.stat-icon.purple { background: rgba(99, 102, 241, 0.2); color: var(--primary-light); }

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 5px;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

@media (max-width: 1200px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .stats-grid { grid-template-columns: 1fr; }
    .admin-sidebar { display: none; }
    .admin-content { margin-left: 0; }
}

/* ===== UTILITY CLASSES ===== */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-1 { margin-top: 10px; }
.mt-2 { margin-top: 20px; }
.mt-3 { margin-top: 30px; }
.mb-1 { margin-bottom: 10px; }
.mb-2 { margin-bottom: 20px; }
.mb-3 { margin-bottom: 30px; }

.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-1 { gap: 10px; }
.gap-2 { gap: 20px; }

.hidden { display: none !important; }

/* ===== LOADING SPINNER ===== */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(99, 102, 241, 0.2);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 20px;
    z-index: 3000;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 15px 25px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    animation: slideInRight 0.3s ease;
    display: flex;
    align-items: center;
    gap: 12px;
    max-width: 400px;
}

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

.toast-success { border-left: 4px solid var(--success); }
.toast-error { border-left: 4px solid var(--danger); }
.toast-warning { border-left: 4px solid var(--warning); }
