/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --tertiary-color: #f093fb;
    --accent-color: #ff6b6b;
    --success-color: #51cf66;
    --warning-color: #ffd43b;
    --light-color: #f8f9fa;
    --dark-color: #2d3748;
    --darker-color: #1a202c;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 50px rgba(0, 0, 0, 0.15);
    --gradient-primary: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    --gradient-accent: linear-gradient(135deg, var(--accent-color), #ff8e8e);
    --gradient-success: linear-gradient(135deg, var(--success-color), #69db7c);
    --transition: all 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-slow: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.7;
    color: var(--dark-color);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Three.js Background */
#three-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.6;
}

/* Header with Sequential Animation */
.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 3rem 0;
    text-align: center;
    box-shadow: var(--shadow);
    margin-bottom: 3rem;
    position: relative;
    overflow: hidden;
}

.header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

.logo {
    font-size: 3.5rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    opacity: 0;
    transform: translateY(30px);
    animation: slideUpFade 0.8s ease-out 0.2s forwards;
}

.subtitle {
    font-size: 1.4rem;
    color: var(--secondary-color);
    margin-bottom: 0.5rem;
    font-weight: 500;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUpFade 0.8s ease-out 0.4s forwards;
}

.student-info {
    font-size: 1.1rem;
    color: var(--dark-color);
    font-weight: 600;
    opacity: 0;
    transform: translateY(20px);
    animation: slideUpFade 0.8s ease-out 0.6s forwards;
    background: rgba(102, 126, 234, 0.1);
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    display: inline-block;
    margin-top: 0.5rem;
}

@keyframes slideUpFade {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main Content with Staggered Animation */
.main-content {
    padding: 2rem 0;
    opacity: 0;
    animation: fadeIn 1s ease-out 0.8s forwards;
}

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

.tasks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
    gap: 2.5rem;
    perspective: 1000px;
}

/* Task Cards with Sequential Entrance Animation */
.task-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    height: 100%;
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transform: translateY(50px) rotateX(10deg);
    animation: cardEntrance 0.8s ease-out forwards;
}

.task-card:nth-child(1) { animation-delay: 1s; }
.task-card:nth-child(2) { animation-delay: 1.2s; }
.task-card:nth-child(3) { animation-delay: 1.4s; }
.task-card:nth-child(4) { animation-delay: 1.6s; }
.task-card:nth-child(5) { animation-delay: 1.8s; }
.task-card:nth-child(6) { animation-delay: 2s; }

@keyframes cardEntrance {
    to {
        opacity: 1;
        transform: translateY(0) rotateX(0);
    }
}

.task-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: var(--shadow-hover);
}

.card-header {
    padding: 2rem;
    background: var(--gradient-primary);
    color: white;
    position: relative;
    overflow: hidden;
}

.card-header::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.1), transparent);
    transform: rotate(45deg);
    transition: var(--transition-slow);
}

.task-card:hover .card-header::after {
    transform: rotate(45deg) translate(20%, 20%);
}

.task-title {
    font-size: 1.6rem;
    margin: 0;
    font-weight: 700;
    position: relative;
    z-index: 2;
}

.card-body {
    padding: 2rem;
    flex-grow: 1;
    position: relative;
}

.task-description {
    color: var(--dark-color);
    line-height: 1.7;
    font-size: 1rem;
}

.card-footer {
    padding: 1.5rem 2rem;
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    background: rgba(248, 249, 250, 0.8);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* Enhanced Buttons with Ripple Effect */
.btn {
    padding: 0.9rem 1.5rem;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.95rem;
    flex: 1;
    min-width: 110px;
    text-align: center;
    position: relative;
    overflow: hidden;
    background: var(--gradient-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

.btn-primary {
    background: var(--gradient-primary);
}

.btn-secondary {
    background: var(--gradient-success);
    box-shadow: 0 4px 15px rgba(81, 207, 102, 0.3);
}

.btn-secondary:hover {
    box-shadow: 0 8px 25px rgba(81, 207, 102, 0.4);
}

.btn-tertiary {
    background: var(--gradient-accent);
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

.btn-tertiary:hover {
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
}

.no-tasks {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    font-size: 1.3rem;
    color: var(--dark-color);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    opacity: 0;
    transform: scale(0.9);
    animation: scaleIn 0.6s ease-out 1s forwards;
}

@keyframes scaleIn {
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Enhanced Footer with Continuous Animation */
.footer {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    padding: 2rem 0;
    text-align: center;
    margin-top: 4rem;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

.footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    animation: progress 3s ease-in-out infinite;
}

@keyframes progress {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.footer-text {
    font-size: 1.1rem;
    color: var(--dark-color);
    font-weight: 700;
    position: relative;
    padding: 0.5rem 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px rgba(102, 126, 234, 0.3),
                     0 0 20px rgba(102, 126, 234, 0.2),
                     0 0 30px rgba(102, 126, 234, 0.1);
    }
    to {
        text-shadow: 0 0 15px rgba(102, 126, 234, 0.4),
                     0 0 25px rgba(102, 126, 234, 0.3),
                     0 0 35px rgba(102, 126, 234, 0.2);
    }
}

/* Enhanced Admin Login Link */
.admin-login {
    position: fixed;
    bottom: 25px;
    right: 25px;
    background: var(--gradient-accent);
    color: white;
    padding: 1rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 700;
    transition: var(--transition);
    box-shadow: 0 8px 25px rgba(255, 107, 107, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0;
    transform: translateX(100px);
    animation: slideInRight 0.8s ease-out 2.2s forwards;
}

@keyframes slideInRight {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.admin-login:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 15px 35px rgba(255, 107, 107, 0.6);
}

.admin-login::before {
    content: '⚡';
    font-size: 1.2rem;
}

/* Enhanced Modals with 3D Effect */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
}

.modal-content {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(30px) saturate(180%);
    margin: 5% auto;
    border-radius: 25px;
    width: 90%;
    max-width: 900px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.8) rotateX(5deg);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.modal.show .modal-content {
    transform: scale(1) rotateX(0);
    opacity: 1;
}

.modal-header {
    padding: 2rem;
    background: var(--gradient-primary);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.modal-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255,255,255,0.1) 50%, transparent 70%);
    animation: modalShine 3s ease-in-out infinite;
}

@keyframes modalShine {
    0%, 100% { transform: translateX(-100%); }
    50% { transform: translateX(100%); }
}

.modal-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    position: relative;
    z-index: 2;
}

.close {
    color: white;
    font-size: 2.2rem;
    font-weight: bold;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    z-index: 2;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.close:hover {
    transform: scale(1.1) rotate(90deg);
    background: rgba(255, 255, 255, 0.3);
}

.modal-body {
    padding: 2.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Enhanced Code Display */
.code-container {
    background: #1a1a1a;
    border-radius: 15px;
    overflow: hidden;
    max-height: 60vh;
    overflow-y: auto;
    border: 1px solid #333;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
}

#codeContent {
    color: #e9ecef;
    padding: 2rem;
    font-family: 'Fira Code', 'Courier New', monospace;
    font-size: 0.95rem;
    line-height: 1.6;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 0;
}

/* Enhanced Video Container */
.video-container {
    position: relative;
    width: 100%;
    height: 0;
    padding-bottom: 56.25%;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

/* Floating Particles Effect */
.floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

.particle {
    position: absolute;
    background: var(--primary-color);
    border-radius: 50%;
    opacity: 0.3;
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(180deg); }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: var(--gradient-primary);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--secondary-color);
}

/* Responsive Design with Smooth Transitions */
@media (max-width: 1200px) {
    .tasks-grid {
        grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
        gap: 2rem;
    }
}

@media (max-width: 768px) {
    .tasks-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .logo {
        font-size: 2.5rem;
    }
    
    .card-footer {
        flex-direction: column;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
        border-radius: 20px;
    }
    
    .header {
        padding: 2rem 0;
    }
    
    .btn {
        min-width: 100%;
    }
}

@media (max-width: 480px) {
    .header {
        padding: 1.5rem 0;
    }
    
    .logo {
        font-size: 2rem;
    }
    
    .subtitle {
        font-size: 1.1rem;
    }
    
    .student-info {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .admin-login {
        bottom: 15px;
        right: 15px;
        padding: 0.8rem 1.2rem;
        font-size: 0.9rem;
    }
}

/* Loading Animation */
.loading-spinner {
    display: inline-block;
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Hover Effects for Interactive Elements */
.interactive:hover {
    transform: translateY(-2px);
    transition: var(--transition);
}

/* Focus States for Accessibility */
.btn:focus,
.close:focus,
.admin-login:focus {
    outline: 3px solid var(--accent-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .admin-login,
    .three-background,
    .modal {
        display: none !important;
    }
    
    .task-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ddd;
    }
}