/* Fullscreen Image Modal Styles */
#image-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.95);
  justify-content: center;
  align-items: center;
  cursor: pointer;
}
#image-modal-img {
  max-width: 90vw;
  max-height: 90vh;
  box-shadow: 0 0 40px #000;
  border-radius: 8px;
}
/* CSS Variables for theming */
:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #059669;
    --danger-color: #dc2626;
    --warning-color: #d97706;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --border-color: #334155;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Page Management */
.page {
    display: none;
    min-height: 100vh;
}

.page.active {
    display: block;
}

/* Login Page */
.login-container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-header h1 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    animation: fadeInUp 0.8s ease;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease 0.2s both;
}

/* Dynamic Quotes Styles */
.quotes-container {
    margin: 2rem 0;
    animation: fadeInUp 0.8s ease 0.4s both;
    width: 100%;
    max-width: 500px;
}

.quote-card {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 1.5rem;
    border-radius: 12px;
    text-align: center;
    position: relative;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    transition: all 0.5s ease;
    opacity: 1;
    transform: translateY(0);
    cursor: pointer;
}

.quote-card:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow: 0 15px 45px rgba(102, 126, 234, 0.4);
}

.quote-card.fade-out {
    opacity: 0;
    transform: translateY(-10px);
}

.quote-icon {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    opacity: 0.8;
    transition: transform 0.3s ease;
}

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

.quote-text {
    font-size: 1.1rem;
    font-style: italic;
    margin: 0 0 1rem 0;
    line-height: 1.5;
    transition: transform 0.3s ease;
}

.quote-card:hover .quote-text {
    transform: translateY(-2px);
}

.quote-author {
    font-size: 0.9rem;
    opacity: 0.9;
    font-weight: 500;
    transition: opacity 0.3s ease;
}

.quote-card:hover .quote-author {
    opacity: 1;
}

.login-form {
    background-color: var(--bg-primary);
    padding: 2rem;
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 400px;
    animation: fadeInUp 0.8s ease 0.6s both;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.login-form:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15);
}

.role-selector {
    display: flex;
    margin-bottom: 1.5rem;
    border-radius: 0.5rem;
    overflow: hidden;
    background-color: var(--bg-tertiary);
}

.role-btn {
    flex: 1;
    padding: 1rem;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.role-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.6s ease;
}

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

.role-btn:hover {
    transform: translateY(-2px);
    color: var(--primary-color);
}

.role-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.input-group {
    margin-bottom: 1rem;
}

.input-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 500;
}

.input-group input {
    width: 100%;
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateZ(0);
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1), 0 4px 12px rgba(102, 126, 234, 0.15);
    transform: translateY(-2px);
}

.input-group input:hover:not(:focus) {
    border-color: var(--accent-color);
    transform: translateY(-1px);
}

.login-btn {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    border: none;
    border-radius: 0.5rem;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    transform: translateY(0);
}

.login-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: left 0.6s ease;
}

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

.login-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.login-btn:active {
    transform: translateY(-1px);
}

.error-message {
    color: var(--danger-color);
    text-align: center;
    margin-top: 1rem;
    padding: 0.5rem;
    border-radius: 0.25rem;
    background-color: rgba(220, 38, 38, 0.1);
    display: none;
}

.error-message.show {
    display: block;
}

/* Admin Dashboard */
.admin-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
}

.nav-brand h2 {
    color: var(--primary-color);
    font-size: 1.5rem;
}

.nav-menu {
    display: flex;
    gap: 0.5rem;
}

.nav-btn {
    padding: 0.75rem 1rem;
    border: none;
    background-color: transparent;
    color: var(--text-secondary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nav-btn:hover, .nav-btn.active {
    background-color: var(--primary-color);
    color: white;
}

.logout-btn {
    padding: 0.5rem 1rem;
    background-color: var(--danger-color);
    color: white;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.logout-btn:hover {
    background-color: #b91c1c;
}

.admin-content {
    padding: 2rem;
}

.admin-section {
    display: none;
}

.admin-section.active {
    display: block;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.section-header h3 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

/* Buttons */
.btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

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

.btn-primary:hover {
    background-color: #1d4ed8;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

.btn-secondary:hover {
    background-color: #475569;
}

.btn-success {
    background-color: var(--success-color);
    color: white;
}

.btn-success:hover {
    background-color: #047857;
}

.btn-success:disabled {
    background-color: var(--text-secondary);
    cursor: not-allowed;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-danger:hover {
    background-color: #b91c1c;
}

/* Grids */
.posts-grid, .candidates-grid, .voters-grid, .results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.card {
    background-color: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card h4 {
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

.card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.card-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
}

.modal.show {
    display: block;
}

.modal-content {
    background-color: var(--bg-primary);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 1rem;
    width: 90%;
    max-width: 500px;
    position: relative;
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
}

.close:hover {
    color: var(--text-primary);
}

.modal-content h4 {
    margin-bottom: 1.5rem;
    color: var(--primary-color);
}

.modal-content form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.modal-content input, .modal-content textarea, .modal-content select {
    padding: 0.75rem;
    border: 2px solid var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.modal-content input:focus, .modal-content textarea:focus, .modal-content select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.modal-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

/* Voter Page */
.voter-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
    box-shadow: var(--shadow);
}

.voter-nav .nav-brand {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.voter-nav h2 {
    color: var(--primary-color);
}

#voter-name-display {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.voter-content {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

/* Voting Progress */
.voting-progress {
    background-color: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: var(--shadow);
}

.progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 1rem;
    background-color: var(--bg-tertiary);
    border-radius: 0.5rem;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background-color: var(--success-color);
    width: 0%;
    transition: width 0.3s ease;
}

/* Voting Sections */
.voting-sections {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    margin-bottom: 2rem;
}

.voting-section {
    background-color: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.voting-section h3 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.candidates-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
    margin-top: 1rem;
}

.candidate-card {
    border: 2px solid var(--border-color);
    border-radius: 1rem;
    padding: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background-color: var(--bg-secondary);
}

.candidate-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.candidate-card.selected {
    border-color: var(--success-color);
    background-color: rgba(5, 150, 105, 0.1);
}

.candidate-image {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 1rem;
    display: block;
    background-color: var(--bg-tertiary);
}

.candidate-info h4 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.candidate-slogan {
    text-align: center;
    font-style: italic;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.candidate-bio {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.candidate-media {
    text-align: center;
}

.candidate-video {
    width: 100%;
    max-width: 200px;
    height: 150px;
    border-radius: 0.5rem;
}

/* Voting Actions */
.voting-actions {
    text-align: center;
    padding: 2rem 0;
}

/* Results */
.result-card {
    background-color: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.result-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    text-align: center;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: 0.5rem;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

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

.chart-container {
    position: relative;
    height: 300px;
    margin-top: 1rem;
}

/* Reset Section */
.reset-container {
    max-width: 500px;
    margin: 0 auto;
}

.warning-box {
    background-color: rgba(217, 119, 6, 0.1);
    border: 1px solid var(--warning-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.warning-box i {
    font-size: 2rem;
    color: var(--warning-color);
    margin-bottom: 1rem;
}

.warning-box h4 {
    color: var(--warning-color);
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-nav, .voter-nav {
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .nav-menu {
        flex-wrap: wrap;
        justify-content: center;
    }

    .admin-content, .voter-content {
        padding: 1rem;
    }

    .section-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .posts-grid, .candidates-grid, .voters-grid, .results-grid {
        grid-template-columns: 1fr;
    }

    .candidates-container {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 10% auto;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .login-header h1 {
        font-size: 2rem;
    }

    .login-form {
        padding: 1.5rem;
    }

    .role-selector {
        flex-direction: column;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

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

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

@keyframes modalSlideIn {
    from {
        transform: translateY(50px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

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

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

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Page Transition */
.page {
    opacity: 0;
    transform: translateX(20px);
    transition: all 0.5s ease;
}

.page.active {
    opacity: 1;
    transform: translateX(0);
}

/* Navigation Animation */
.nav-btn {
    transition: all 0.3s ease;
    position: relative;
}

.nav-btn::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--primary-color);
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.nav-btn.active::after,
.nav-btn:hover::after {
    width: 80%;
}

/* Loading Animation for Forms */
.btn.loading {
    pointer-events: none;
    opacity: 0.8;
}

.btn.loading::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 8px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Additional Hover Effects */
.card-title, .section-title {
    transition: color 0.3s ease;
}

.card-title:hover, .section-title:hover {
    color: var(--primary-color);
}

/* Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced Focus States */
button:focus, input:focus, select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading States */
.loading-shimmer {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

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

/* Hover Effects for Icons */
i {
    transition: transform 0.3s ease;
}

.btn:hover i, .nav-btn:hover i {
    transform: scale(1.1);
}

/* Enhanced Delete Buttons */
.delete-btn {
    transition: all 0.3s ease;
}

.delete-btn:hover {
    transform: scale(1.1) rotate(5deg);
    color: var(--danger-color);
}

/* Pulse Animation for Important Elements */
.pulse {
    animation: pulse 2s infinite;
}

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

    .result-stats {
        grid-template-columns: 1fr;
    }

@media (max-width: 480px) {
    .login-header h1 {
        font-size: 2rem;
    }

    .login-form {
        padding: 1.5rem;
    }

    .role-selector {
        flex-direction: column;
    }

    .theme-toggle {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }
}

/* Animation for smooth transitions */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page.active {
    animation: fadeIn 0.3s ease-in-out;
}

/* File Upload Styles */
.file-upload-section {
    margin-bottom: 1rem;
}

.file-upload-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

.upload-options {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.upload-options span {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.upload-options input[type="url"] {
    flex: 1;
    min-width: 200px;
    padding: 0.5rem;
    border: 2px solid var(--border-color);
    border-radius: 0.25rem;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

.file-preview {
    margin-top: 0.5rem;
    padding: 0.5rem;
    border: 2px dashed var(--border-color);
    border-radius: 0.5rem;
    background-color: var(--bg-secondary);
    min-height: 60px;
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
}

.file-preview.show {
    display: flex;
}

.file-preview img {
    max-width: 100%;
    max-height: 150px;
    border-radius: 0.25rem;
}

.file-preview video {
    max-width: 100%;
    max-height: 150px;
    border-radius: 0.25rem;
}

.file-preview .preview-info {
    text-align: center;
    color: var(--text-secondary);
}

.file-preview .remove-file {
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    background: var(--danger-color);
    color: white;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

.file-preview .remove-file:hover {
    background: #b91c1c;
}

.file-size-info {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

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

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-color);
}
