/* ===================================
   Isola Polls - Styles
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;600;700&display=swap');

:root {
    --primary-color: #007BFF;
    --primary-dark: #0062CC;
    --accent-color: #FD7E14;
    --bg-color: #f7f9fc;
    --card-bg: #FFFFFF;
    --text-dark: #141922;
    --text-light: #5d6776;
    --shadow: 0 4px 14px rgba(16, 30, 54, 0.08), 0 2px 4px rgba(16, 30, 54, 0.05);
    --shadow-lg: 0 16px 36px rgba(16, 30, 54, 0.14), 0 6px 12px rgba(16, 30, 54, 0.08);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* ===================================
   Login Screen
   =================================== */

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 20px;
}

.login-card {
    background: var(--card-bg);
    padding: 40px;
    border-radius: 20px;
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 100%;
    text-align: center;
}

.login-logo {
    width: 80px;
    height: auto;
    margin-bottom: 20px;
}

.login-card h1 {
    color: var(--primary-color);
    font-size: 28px;
    margin-bottom: 10px;
}

.login-card p {
    color: var(--text-light);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 20px;
    text-align: right;
}

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

.form-group input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.error-message {
    background: #FFEBEE;
    color: #F44336;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 15px;
    font-size: 14px;
}

.error-message.hidden {
    display: none;
}

.btn-login {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

/* ===================================
   Main Container
   =================================== */

.main-container {
    min-height: 100vh;
    background: var(--bg-color);
}

.hidden {
    display: none !important;
}

/* Header */
.header {
    background: var(--card-bg);
    padding: 20px 40px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

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

.header-logo {
    width: 50px;
    height: auto;
}

.header-text h1 {
    color: var(--primary-color);
    font-size: 24px;
    margin-bottom: 2px;
}

.header-text p {
    color: var(--text-light);
    font-size: 13px;
}

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

.welcome-text {
    color: var(--text-light);
    font-size: 14px;
}

.btn-logout {
    padding: 10px 20px;
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Loading */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    gap: 20px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #E0E0E0;
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Content */
.content {
    padding: 30px 40px;
    max-width: 1200px;
    margin: 0 auto;
}

.section-title {
    font-size: 24px;
    color: var(--text-dark);
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 3px solid var(--primary-color);
}

.section-title i { color: var(--accent-color); }
.empty-icon i { color: #c3cdd9; }

/* Polls Grid */
.polls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
}

.poll-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
}

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

.poll-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.poll-card h3 {
    font-size: 18px;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.poll-card p {
    color: var(--text-light);
    font-size: 14px;
    margin-bottom: 15px;
}

.poll-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

.poll-votes {
    display: flex;
    align-items: center;
    gap: 5px;
    color: var(--primary-color);
    font-weight: 600;
}

.poll-date {
    color: var(--text-light);
    font-size: 13px;
}

.poll-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.poll-badge.active {
    background: #e6f2ff;
    color: #0062cc;
}

.poll-badge.voted {
    background: #E3F2FD;
    color: #1976D2;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.empty-state h3 {
    color: var(--text-dark);
    margin-bottom: 10px;
}

.empty-state p {
    color: var(--text-light);
}

/* ===================================
   Modal
   =================================== */

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 20px;
}

.modal-content {
    background: var(--card-bg);
    padding: 30px;
    border-radius: 20px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-btn {
    position: absolute;
    top: 15px;
    left: 20px;
    font-size: 28px;
    cursor: pointer;
    color: var(--text-light);
    transition: color 0.3s ease;
}

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

.modal-content h2 {
    font-size: 22px;
    color: var(--text-dark);
    margin-bottom: 10px;
    padding-left: 30px;
}

.poll-description {
    color: var(--text-light);
    margin-bottom: 25px;
    font-size: 14px;
}

/* Poll Options */
.poll-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 25px;
}

.option-item {
    display: flex;
    align-items: center;
    padding: 16px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.option-item:hover {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.05);
}

.option-item.selected {
    border-color: var(--primary-color);
    background: rgba(0, 123, 255, 0.1);
}

.option-radio {
    width: 22px;
    height: 22px;
    border: 2px solid #ccc;
    border-radius: 50%;
    margin-left: 12px;
    position: relative;
    flex-shrink: 0;
}

.option-item.selected .option-radio {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.option-item.selected .option-radio::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px;
    font-weight: bold;
}

.option-text {
    flex: 1;
    font-size: 15px;
    color: var(--text-dark);
}

/* Modal Actions */
.modal-actions {
    margin-bottom: 20px;
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

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

.btn-primary:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Poll Results */
.poll-results {
    margin-top: 20px;
}

.result-item {
    margin-bottom: 15px;
}

.result-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.result-text {
    font-size: 14px;
    color: var(--text-dark);
}

.result-percentage {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-color);
}

.result-bar {
    height: 10px;
    background: #e0e0e0;
    border-radius: 5px;
    overflow: hidden;
}

.result-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 5px;
    transition: width 0.5s ease;
}

.total-votes {
    text-align: center;
    color: var(--text-light);
    font-size: 14px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}

/* Share Section */
.share-section {
    margin-top: 20px;
    text-align: center;
}

.btn-share {
    padding: 12px 24px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-share:hover {
    background: #e36a05;
    transform: translateY(-2px);
}

/* ===================================
   Responsive
   =================================== */

@media (max-width: 768px) {
    .header {
        padding: 15px 20px;
        flex-direction: column;
        text-align: center;
    }

    .header-content {
        flex-direction: column;
        gap: 10px;
    }

    .header-text h1 {
        font-size: 20px;
    }

    .content {
        padding: 20px;
    }

    .section-title {
        font-size: 20px;
    }

    .polls-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        padding: 20px;
    }

    .modal-content h2 {
        font-size: 18px;
    }
}

/* ===================================
   Registration Popup
   =================================== */

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    padding: 20px;
}

.popup-content {
    background: white;
    padding: 30px;
    border-radius: 20px;
    width: 100%;
    max-width: 400px;
    text-align: center;
    position: relative;
    animation: popIn 0.3s ease;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.popup-close {
    position: absolute;
    top: 10px;
    left: 15px;
    font-size: 28px;
    background: none;
    border: none;
    cursor: pointer;
    color: #999;
    transition: color 0.3s;
}

.popup-close:hover {
    color: #333;
}

.popup-icon {
    font-size: 60px;
    margin-bottom: 15px;
}

.popup-content h3 {
    font-size: 22px;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.popup-content>p {
    color: var(--text-light);
    margin-bottom: 15px;
}

.popup-benefits {
    text-align: right;
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    background: #f5f5f5;
    padding: 15px;
    border-radius: 10px;
}

.popup-benefits li {
    padding: 5px 0;
    color: var(--text-dark);
    font-size: 14px;
}

.popup-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.btn-popup-primary {
    padding: 14px;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.3s;
}

.btn-popup-primary:hover {
    transform: translateY(-2px);
}

.btn-popup-secondary {
    padding: 12px;
    background: transparent;
    color: var(--text-light);
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-popup-secondary:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}