/* HBO Max Style - Dark Theme */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

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

/* Improve touch target sizes and mobile interaction */
@media (hover: none) and (pointer: coarse) {
    /* Touch device specific styles */
    button, input[type="file"], input[type="url"] {
        min-height: 44px; /* Apple's recommended touch target */
    }
    
    button:active {
        transform: scale(0.98);
    }
}

body {
    font-family: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.6;
    color: #e2e8f0;
    background: #0a0a0f;
    background-image: 
        radial-gradient(circle at 20% 80%, rgba(0, 191, 255, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(0, 191, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(0, 191, 255, 0.08) 0%, transparent 50%);
    min-height: 100vh;
    overflow-x: hidden;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 10000;
    padding: 10px 14px;
    border-radius: 8px;
    background: #00D4FF;
    color: #04131a;
    font-weight: 700;
    text-decoration: none;
}

.skip-link:focus,
.skip-link:focus-visible {
    left: 12px;
    top: 12px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid #00D4FF;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(10, 10, 15, 0.95);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2.5rem;
    background: rgba(10, 10, 15, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 24px;
    border: 1px solid rgba(0, 191, 255, 0.2);
    box-shadow: 
        0 32px 64px rgba(0, 0, 0, 0.6),
        0 8px 32px rgba(0, 191, 255, 0.15),
        inset 0 1px 0 rgba(0, 191, 255, 0.1);
    margin-top: 2rem;
    margin-bottom: 2rem;
    position: relative;
}

h1 {
    text-align: center;
    margin-bottom: 2rem;
    color: #ffffff;
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #00bfff 0%, #1e90ff 50%, #0080ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 30px rgba(0, 191, 255, 0.5);
}

h2 {
    color: #f1f5f9;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(0, 191, 255, 0.3);
    padding-bottom: 0.5rem;
    font-weight: 600;
}

.upload-section {
    margin-bottom: 2rem;
}

.upload-option {
    background: rgba(5, 5, 10, 0.8);
    backdrop-filter: blur(10px);
    padding: 2rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0, 191, 255, 0.2);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.upload-option::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(0, 191, 255, 0.1) 0%, rgba(30, 144, 255, 0.1) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none;
}

.upload-option:hover {
    border-color: rgba(0, 191, 255, 0.6);
    transform: translateY(-4px);
    box-shadow: 
        0 20px 40px rgba(0, 0, 0, 0.5),
        0 8px 16px rgba(0, 191, 255, 0.3);
}

.upload-option:hover::before {
    opacity: 1;
}

.upload-option h3 {
    margin-bottom: 1rem;
    color: #ffffff;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

form {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

input[type="file"], input[type="url"] {
    flex: 1;
    padding: 1rem 1.25rem;
    background: rgba(10, 10, 15, 0.9);
    border: 1px solid rgba(0, 191, 255, 0.3);
    border-radius: 12px;
    font-size: 1rem;
    min-width: 250px;
    color: #e2e8f0;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    font-family: 'Inter', sans-serif;
}

input[type="file"]:focus, input[type="url"]:focus {
    outline: none;
    border-color: rgba(0, 191, 255, 0.8);
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.2);
    background: rgba(15, 15, 20, 0.95);
}

input[type="file"]::placeholder, input[type="url"]::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

button {
    background: linear-gradient(135deg, #00bfff 0%, #1e90ff 50%, #0080ff 100%);
    color: white;
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    box-shadow: 
        0 8px 24px rgba(0, 191, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button::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;
}

button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 
        0 16px 40px rgba(0, 191, 255, 0.4),
        0 8px 16px rgba(0, 191, 255, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

button:hover::before {
    left: 100%;
}

button:active {
    transform: translateY(-1px) scale(1.01);
}

button:disabled {
    background: rgba(160, 174, 192, 0.3);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.6;
}

.status {
    padding: 1.25rem;
    border-radius: 12px;
    margin-top: 1rem;
    text-align: center;
    font-weight: 600;
    display: none;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.status.success {
    background: rgba(72, 187, 120, 0.2);
    color: #68d391;
    border: 1px solid rgba(72, 187, 120, 0.3);
    box-shadow: 0 8px 24px rgba(72, 187, 120, 0.2);
}

.status.error {
    background: rgba(245, 101, 101, 0.2);
    color: #fc8181;
    border: 1px solid rgba(245, 101, 101, 0.3);
    box-shadow: 0 8px 24px rgba(245, 101, 101, 0.2);
}

.status.loading {
    background: rgba(0, 191, 255, 0.2);
    color: #00bfff;
    border: 1px solid rgba(0, 191, 255, 0.3);
    box-shadow: 0 8px 24px rgba(0, 191, 255, 0.2);
}

/* Enhanced Loading animation with glow effect */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(0, 191, 255, 0.5); }
    50% { box-shadow: 0 0 40px rgba(0, 191, 255, 0.8), 0 0 60px rgba(0, 191, 255, 0.6); }
}

.loading::after {
    content: '';
    display: inline-block;
    width: 20px;
    height: 20px;
    margin-left: 12px;
    border: 3px solid transparent;
    border-top: 3px solid #00bfff;
    border-radius: 50%;
    animation: spin 1s linear infinite, glow 2s ease-in-out infinite;
}

/* Responsive design with enhanced dark theme */
@media (max-width: 1024px) {
    .container {
        max-width: 95%;
        margin: 1rem auto;
        padding: 2rem;
        border-radius: 20px;
    }
    
    h1 {
        font-size: 2.5rem;
    }
}

@media (max-width: 768px) {
    body {
        padding: 0.5rem;
    }
    
    .container {
        margin: 0.5rem;
        padding: 1.5rem;
        border-radius: 16px;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    h1 {
        font-size: 2.25rem;
        margin-bottom: 1.5rem;
    }
    
    h2 {
        font-size: 1.5rem;
    }
    
    .upload-option {
        padding: 1.5rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    form {
        flex-direction: column;
        gap: 1rem;
    }
    
    input[type="file"], input[type="url"] {
        min-width: auto;
        width: 100%;
        padding: 1rem;
        font-size: 1rem;
        border-radius: 10px;
    }
    
    button {
        width: 100%;
        padding: 1.125rem 1rem;
        font-size: 1rem;
        border-radius: 10px;
    }
}

@media (max-width: 480px) {
    .container {
        margin: 0.25rem;
        padding: 1.25rem;
        border-radius: 14px;
    }
    
    h1 {
        font-size: 2rem;
        margin-bottom: 1rem;
    }
    
    .upload-option {
        padding: 1.25rem;
        border-radius: 10px;
    }
    
    .upload-option h3 {
        font-size: 1.1rem;
    }
    
    input[type="file"], input[type="url"] {
        padding: 0.875rem;
        font-size: 0.95rem;
        border-radius: 8px;
    }
    
    button {
        padding: 0.875rem;
        font-size: 0.95rem;
        border-radius: 8px;
    }
    
    .status {
        font-size: 0.9rem;
        padding: 1rem;
        border-radius: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 360px) {
    .container {
        margin: 0.1rem;
        padding: 1rem;
        border-radius: 12px;
    }
    
    h1 {
        font-size: 1.75rem;
    }
    
    .upload-option h3 {
        font-size: 1rem;
    }
}

/* Additional HBO Max-style enhancements */
.container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 191, 255, 0.8), transparent);
}

/* Scrollbar styling for webkit browsers */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(20, 20, 35, 0.5);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #00bfff, #1e90ff);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #1ebfff, #00bfff);
}

/* Video-specific styles */
.btn-media {
    background: linear-gradient(135deg, #e53e3e, #ff6b6b) !important;
    color: white !important;
    border: none !important;
    padding: 8px 16px !important;
    border-radius: 6px !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    margin-right: 8px !important;
    margin-bottom: 6px !important;
}

.btn-media:hover {
    background: linear-gradient(135deg, #c53030, #e53e3e) !important;
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3) !important;
}

.text-source-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition: all 0.2s ease;
}

.text-source-item:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.text-source-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #ffffff;
}

.text-source-meta {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.6);
    margin-bottom: 15px;
}

/* Video form styles */
#youtubeSourceForm, #videoFileSourceForm {
    animation: fadeInUp 0.3s ease;
}

#youtubeUrl, #youtubeTitle, #videoFileInput, #videoFileTitle {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px;
    color: #ffffff;
    width: 100%;
    font-size: 14px;
    transition: all 0.2s ease;
}

#youtubeUrl:focus, #youtubeTitle:focus, 
#videoFileInput:focus, #videoFileTitle:focus {
    outline: none;
    border-color: #00bfff;
    background: rgba(0, 191, 255, 0.15);
    box-shadow: 0 0 0 3px rgba(0, 191, 255, 0.2);
}

/* Media exercise card enhanced styling */
#mediaCard {
    background: linear-gradient(135deg, rgba(229, 62, 62, 0.1), rgba(255, 107, 107, 0.05));
    border-color: rgba(229, 62, 62, 0.3);
}

#mediaCard .exercise-icon {
    font-size: 2.5rem;
    text-shadow: 0 2px 4px rgba(229, 62, 62, 0.3);
}

#mediaCard.disabled {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.05);
    opacity: 0.4;
}

/* Square Exercise Icons */
.exercise-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 150px));
    gap: 1rem;
    margin: 2rem 0;
    justify-content: start;
}

.exercise-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(5, 5, 10, 0.8);
    border: 1px solid rgba(0, 191, 255, 0.2);
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s ease;
    cursor: pointer;
    text-decoration: none;
    color: #e2e8f0;
    width: 120px;
    height: 120px;
    justify-content: center;
}

.exercise-card:hover {
    background: rgba(0, 191, 255, 0.05);
    border-color: rgba(0, 191, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(0, 191, 255, 0.2);
    color: #f1f5f9;
    text-decoration: none;
}

.exercise-icon {
    font-size: 2rem;
    color: #00bfff;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(0, 191, 255, 0.3);
}

.exercise-label {
    font-size: 0.8rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    color: inherit;
}

.exercise-card.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(5, 5, 10, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
}

.exercise-card.disabled:hover {
    transform: none;
    box-shadow: none;
    background: rgba(5, 5, 10, 0.4);
    border-color: rgba(255, 255, 255, 0.1);
    color: #e2e8f0;
}

@media (max-width: 768px) {
    .exercise-grid {
        grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
        gap: 0.8rem;
    }
    
    .exercise-card {
        width: 100px;
        height: 100px;
        padding: 0.8rem;
    }
    
    .exercise-icon {
        font-size: 1.5rem;
    }
    
    .exercise-label {
        font-size: 0.75rem;
    }
    
    .classes-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 15px;
    }
}

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

/* Curriculum Manager Class Grid Fixes */
.classes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 200px));
    gap: 20px;
    margin-top: 15px;
    justify-content: start;
}

/* Desktop: limit class card width to prevent oversizing */
@media (min-width: 1200px) {
    .classes-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 220px));
    }
    
    .exercise-grid {
        grid-template-columns: repeat(auto-fit, minmax(120px, 140px));
        max-width: 800px;
    }
}

/* Tablet responsiveness */
@media (min-width: 768px) and (max-width: 1199px) {
    .classes-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 180px));
    }
}