/**
 * Enhanced Video Tracker Styles
 *
 * Styles for video progress tracking, Mark as Watched button,
 * confetti effects, and progress UI components.
 *
 * @package ThinkForge
 */

/* Video Progress Container */
.video-tracker-container {
    position: relative;
    margin: 20px 0;
}

.video-progress-section {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.video-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.video-progress-title {
    font-weight: 600;
    color: #1f2937;
    font-size: 14px;
}

.video-progress-percentage {
    font-weight: 700;
    color: #3b82f6;
    font-size: 16px;
}

/* Progress Bar */
.video-progress-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.video-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
    position: relative;
}

.video-progress-fill::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.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 2s infinite;
}

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

/* Progress Stats */
.video-progress-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.progress-stat {
    text-align: center;
    padding: 8px;
    background: white;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.progress-stat-label {
    font-size: 11px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.progress-stat-value {
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
}

/* Mark as Watched Button */
.mark-as-watched-container {
    margin-top: 16px;
    text-align: center;
}

.mark-as-watched-btn {
    background: linear-gradient(135deg, #059669 0%, #047857 100%);
    color: white;
    border: 2px solid #047857;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 6px 12px rgba(5, 150, 105, 0.4);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    min-height: 48px;
    position: relative;
    z-index: 10;
}

.mark-as-watched-btn:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(5, 150, 105, 0.5);
    background: linear-gradient(135deg, #047857 0%, #065f46 100%);
    border-color: #065f46;
}

.mark-as-watched-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.mark-as-watched-btn .icon {
    width: 16px;
    height: 16px;
}

/* Confetti Animation */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    overflow: hidden;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    background: #3b82f6;
    animation: confetti-fall 3s linear forwards;
}

.confetti-piece:nth-child(2n) {
    background: #ef4444;
    width: 8px;
    height: 8px;
    animation-duration: 2.8s;
    animation-delay: 0.2s;
}

.confetti-piece:nth-child(3n) {
    background: #10b981;
    width: 12px;
    height: 6px;
    animation-duration: 3.2s;
    animation-delay: 0.4s;
}

.confetti-piece:nth-child(4n) {
    background: #f59e0b;
    width: 6px;
    height: 12px;
    animation-duration: 2.6s;
    animation-delay: 0.6s;
}

.confetti-piece:nth-child(5n) {
    background: #8b5cf6;
    width: 14px;
    height: 4px;
    animation-duration: 3.4s;
    animation-delay: 0.8s;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(-100vh) rotate(0deg);
        opacity: 1;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Success Message */
.video-success-message {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 16px;
    border-radius: 8px;
    margin-top: 16px;
    text-align: center;
    font-weight: 600;
    box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25);
    animation: slideUp 0.5s ease;
}

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

/* Certificate Section */
.certificate-section {
    background: linear-gradient(135deg, #fef3c7 0%, #fde68a 100%);
    border: 2px solid #f59e0b;
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.25);
}

.certificate-title {
    font-size: 18px;
    font-weight: 700;
    color: #92400e;
    margin-bottom: 8px;
}

.certificate-description {
    color: #78350f;
    margin-bottom: 16px;
    line-height: 1.5;
}

.certificate-btn {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(245, 158, 11, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.certificate-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(245, 158, 11, 0.35);
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}

/* Quiz Section */
.quiz-section {
    background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
    border: 2px solid #3b82f6;
    border-radius: 8px;
    padding: 20px;
    margin-top: 16px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.25);
}

.quiz-title {
    font-size: 18px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 8px;
}

.quiz-description {
    color: #1e3a8a;
    margin-bottom: 16px;
    line-height: 1.5;
}

.quiz-btn {
    background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
    color: white;
    border: none;
    padding: 14px 28px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(59, 130, 246, 0.25);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.quiz-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(59, 130, 246, 0.35);
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
}

/* Responsive Design */
@media (max-width: 768px) {
    .video-progress-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .mark-as-watched-btn,
    .certificate-btn,
    .quiz-btn {
        width: 100%;
        justify-content: center;
    }
}

/* Loading State */
.video-tracker-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    color: #6b7280;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e5e7eb;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
}

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

/* Error State */
.video-tracker-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    border-radius: 6px;
    padding: 12px;
    color: #dc2626;
    font-size: 14px;
    margin: 16px 0;
}

/* Failsafe Mode */
.failsafe-notice {
    background: #fef3c7;
    border: 1px solid #fde68a;
    border-radius: 6px;
    padding: 12px;
    color: #d97706;
    font-size: 14px;
    margin: 16px 0;
}

.failsafe-notice a {
    color: #92400e;
    text-decoration: underline;
    font-weight: 600;
}

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

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

.slide-up {
    animation: slideUp 0.5s ease;
}

.bounce-in {
    animation: bounceIn 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}