/* Dashboard Specific Styles */

/* Header Navigation */
.nav-links {
    display: flex;
    list-style: none;
    gap: 2rem;
    margin: 0;
    padding-left: 0;
}

.nav-links li {
    margin: 0;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 1rem;
    padding: 0.5rem 0.75rem;
    border-radius: 4px;
    transition: background-color 0.3s ease;
}

.nav-links a:hover {
    background-color: #f0f0f0;
}

/* Profile Section */
.profile-section {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex: 1;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    padding: 0.5rem 0;
    transition: color 0.3s ease;
}

.logo a:hover {
    color: #0056b3;
}

.profile-dropdown {
    position: relative;
    -webkit-app-region: no-drag;
}

.profile-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
}

.profile-info:hover {
    background-color: #e2e6ea;
}

.profile-picture {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #007bff;
}

.profile-details {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.profile-name {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-color);
}

.profile-email {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.dropdown-arrow {
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: transform 0.3s ease;
}

.profile-dropdown.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Profile Menu */
.profile-menu {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background: var(--white);
    min-width: 200px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 0.5rem 0;
    z-index: 1000;
    list-style: none;
    margin: 0.5rem 0 0 0;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.profile-dropdown.active .profile-menu {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.profile-menu li {
    padding: 0;
}

.profile-menu a {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    color: var(--text-color);
    text-decoration: none;
    font-size: 0.9rem;
    transition: background-color 0.3s ease;
}

.profile-menu a:hover {
    background-color: #f8f9fa;
    color: var(--primary-color);
}

.profile-menu i {
    width: 16px;
    font-size: 0.9rem;
}

/* Dashboard Main */
.dashboard-main {
    padding: 2rem 0 4rem;
    min-height: calc(100vh - 200px);
}

.dashboard-header {
    text-align: center;
    margin-bottom: 3rem;
}

.dashboard-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.dashboard-header p {
    font-size: 1.125rem;
    color: var(--text-muted);
}

/* Video Grid */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.video-card {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    position: relative;
}

.video-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
}

.video-thumbnail {
    position: relative;
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.video-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.video-info {
    padding: 1.5rem;
}

.video-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 0.75rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.video-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.video-stats i {
    font-size: 0.8rem;
}

.video-actions {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 6px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 120px;
    justify-content: center;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-sm:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-sm i {
    font-size: 0.8rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .profile-details {
        display: none;
    }

    .profile-info {
        padding: 0.5rem;
    }

    .profile-menu {
        right: -50px;
        min-width: 180px;
    }

    .dashboard-header h1 {
        font-size: 2rem;
    }

    .dashboard-header p {
        font-size: 1rem;
    }

    .video-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .video-actions {
        flex-direction: column;
    }

    .btn-sm {
        flex: none;
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .dashboard-main {
        padding: 1.5rem 0 3rem;
    }

    .dashboard-header {
        margin-bottom: 2rem;
    }

    .dashboard-header h1 {
        font-size: 1.75rem;
    }

    .video-info {
        padding: 1rem;
    }

    .video-title {
        font-size: 1rem;
    }

    .video-stats {
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-sm {
        padding: 0.625rem 1rem;
        font-size: 0.8rem;
    }
}

/* Video card loading state */
.video-card.loading {
    opacity: 0.7;
    pointer-events: none;
}

.video-card.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.4),
        transparent
    );
    animation: loading 1.5s infinite;
}

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

/* Fix for spinner animation */
.fa-spin {
    animation: fa-spin 2s infinite linear;
}

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

/* Modal/Popup Styles */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /* Remove dark overlay background for popup */
    background-color: transparent;
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* View Management */
.view {
    position: absolute;
    width: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    padding: 1.5rem;
}

.view.active {
    position: relative;
    opacity: 1;
    visibility: visible;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

.modal-content {
    background-color: #232c33; /* Updated background color as requested */
    color: #eee; /* Light text color */
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
    box-shadow: 0 4px 20px rgba(255, 255, 255, 0.15);
}

/* Adjust modal header text color */
.modal-header h2 {
    color: #eee;
}

/* Adjust close button color */
.close-modal {
    color: #ccc;
}

.close-modal:hover {
    color: #fff;
    background-color: #333;
}

/* Adjust timer display text color */
.timer-display .seconds {
    color: #eee;
}

.timer-display .seconds.ending {
    color: #ff6b6b;
}

/* Adjust poll options background and text */
.option {
    background: #222;
    border: 2px solid #444;
    color: #eee;
}

.option:hover {
    background: #333;
    border-color: #66b2ff;
}

.option.selected {
    background: #3399ff;
    border-color: #1a73e8;
    color: white;
    box-shadow: 0 4px 12px rgba(51, 153, 255, 0.6);
}

/* Adjust results view background and text */
.results-grid {
    background: #111;
}

.result-bar {
    background: #222;
}

.bar-container {
    background: #333;
}

.bar {
    background: #3399ff;
}

.bar::after {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
}

/* Adjust leaderboard background and text */
.leaderboard {
    background: #111;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

.leaderboard-item {
    background: #222;
}

.rank {
    background: #3399ff;
}

.name {
    color: #eee;
}

.time {
    color: #ccc;
}

.modal.show .modal-content {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #333;
}

.close-modal {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #666;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.close-modal:hover {
    color: #333;
    background-color: #f0f0f0;
}

.modal-body {
    position: relative;
    min-height: 400px;
    max-height: 80vh;
    overflow-y: auto;
}

/* Custom scrollbar for modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #666;
}

/* Progress Circle */
.poll-progress {
    text-align: center;
}

.progress-circle {
    position: relative;
    display: inline-block;
    margin: 1rem 0;
}

.progress-ring-circle {
    transition: stroke-dashoffset 0.3s linear;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke-linecap: round;
}

.timer-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer-display .seconds {
    font-size: 2.5rem;
    font-weight: 600;
    color: #333;
    display: block;
    transition: all 0.3s ease;
}

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

.timer-display .seconds.ending {
    color: #dc3545;
    animation: pulse 1s infinite;
}

.timer-display .unit {
    font-size: 1rem;
    color: #666;
}

/* Poll Options */
.poll-options {
    margin-top: 2rem;
    display: flex;
    flex-direction: row;
    gap: 1rem;
    justify-content: center;
    flex-wrap: nowrap;
}

.option {
    padding: 1rem;
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    font-weight: 500;
    color: #333;
}

.option:hover {
    background: #e7f5ff;
    border-color: #007bff;
    transform: translateY(-2px);
}

.option.selected {
    background: #007bff;
    border-color: #0056b3;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
}

/* Results View */
.results-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding: 0.5rem;
}

.result-bar {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.bar-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #333;
}

.bar-container {
    height: 24px;
    background: #ffebee; /* Light red background */
    border-radius: 12px;
    position: relative;
    overflow: hidden;
}

.bar {
    height: 100%;
    background: #ff4d4d; /* Bright red for progress */
    border-radius: 12px;
    transition: width 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.2) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    transform: translateX(-100%);
    animation: shimmer 2s infinite;
}

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

.result-bar.correct .bar {
    background: #28a745;
}

.percentage {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: #333; /* Dark text color */
    font-weight: 600;
    font-size: 0.875rem;
    background: rgba(
        255,
        255,
        255,
        0.9
    ); /* Semi-transparent white background */
    padding: 2px 6px;
    border-radius: 4px;
}

/* Leaderboard */
.leaderboard {
    background: #fff;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard h3 {
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.25rem;
}

.leaderboard-list {
    display: grid;
    gap: 0.75rem;
}

.leaderboard-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 8px;
    transition: transform 0.2s ease;
}

.leaderboard-item:hover {
    transform: translateX(5px);
}

.rank {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #007bff;
    color: #fff;
    border-radius: 50%;
    font-weight: 600;
    font-size: 0.875rem;
}

.name {
    font-weight: 500;
    color: #333;
}

.time {
    color: #666;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.medal {
    font-size: 1rem;
}

.medal-gold {
    color: #ffd700;
}

.medal-silver {
    color: #c0c0c0;
}

.medal-bronze {
    color: #cd7f32;
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .timer-display .seconds {
        font-size: 2rem;
    }

    .poll-question p {
        font-size: 1rem;
    }

    .leaderboard {
        padding: 1rem;
    }

    .leaderboard-item {
        padding: 0.5rem;
        gap: 0.5rem;
    }
}

.timer-selection h3 {
    margin: 0 0 1rem;
    font-size: 1.1rem;
    color: #666;
}

.timer-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.timer-option {
    cursor: pointer;
}

.timer-option input[type="radio"] {
    display: none;
}

.timer-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.timer-option input[type="radio"]:checked + .timer-box {
    background-color: #e7f5ff;
    border-color: #007bff;
}

.timer-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.timer-unit {
    font-size: 0.875rem;
    color: #666;
    margin-top: 0.25rem;
}

.start-poll-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1rem;
    margin-top: 1rem;
}

.timer-header {
    background-color: #f0f4f8;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    color: #333;
}

.timer-header h3 {
    margin: 0 0 0.25rem 0;
    font-weight: 600;
}

.timer-header small {
    font-size: 0.875rem;
    color: #666;
}

@media (max-width: 480px) {
    .modal-content {
        width: 95%;
    }

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

    .modal-header {
        padding: 1rem;
    }

    .modal-body {
        padding: 1rem;
    }
}
