:root {
    --primary: #6366f1;
    --primary-dark: #4f46e5;
    --secondary: #ec4899;
    --accent: #8b5cf6;
    --bg-dark: #0f172a;
    --card-bg: rgba(30, 41, 59, 0.7);
    --text-white: #f8fafc;
    --text-muted: #94a3b8;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

body {
    background-color: var(--bg-dark);
    background-image: 
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.15) 0, transparent 50%),
        radial-gradient(at 100% 0%, rgba(236, 72, 153, 0.15) 0, transparent 50%),
        radial-gradient(at 50% 100%, rgba(139, 92, 246, 0.15) 0, transparent 50%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-white);
    padding: 20px;
    overflow-x: hidden;
}

.container {
    max-width: 1400px;
    width: 100%;
    z-index: 1;
}

header {
    text-align: center;
    margin-bottom: 40px;
    animation: fadeInDown 0.8s ease-out;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    background: linear-gradient(to right, #818cf8, #f472b6, #a78bfa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 10px;
    letter-spacing: -0.025em;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.1rem;
}

.main-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 40px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    animation: fadeInUp 0.8s ease-out 0.2s both;
}

.upload-zone {
    border: 2px dashed rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 60px 20px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.05);
    transform: scale(1.01);
}

.upload-icon {
    font-size: 48px;
    margin-bottom: 20px;
    display: block;
}

.upload-text {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.upload-hint {
    color: var(--text-muted);
    font-size: 0.9rem;
}

#file-input {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.results {
    margin-top: 40px;
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.results.active {
    display: block;
}

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    text-align: center;
}

.download-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.download-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 24px;
    text-decoration: none;
    color: var(--text-white);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.download-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 10px 20px -5px rgba(99, 102, 241, 0.3);
}

.btn-icon {
    font-size: 24px;
    margin-bottom: 12px;
}

.btn-label {
    font-weight: 600;
    font-size: 0.9rem;
}

.loader {
    display: none;
    text-align: center;
    margin-top: 20px;
}

.preview-section {
    margin-top: 60px;
    display: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding-top: 40px;
    animation: fadeIn 0.8s ease-out;
}

.preview-section.active {
    display: block;
}

.preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 30px;
}

.preview-panel {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 600px;
}

.preview-header {
    background: rgba(255, 255, 255, 0.05);
    padding: 12px 20px;
    font-weight: 700;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-left {
    display: flex;
    align-items: center;
}

.header-download {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.3s ease;
}

.header-download:hover {
    background: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.dl-icon {
    font-size: 1.1rem;
    filter: brightness(1.2);
}

.preview-content {
    flex: 1;
    overflow-y: auto;
    padding: 30px;
    font-size: 0.95rem;
    line-height: 1.6;
    color: #e2e8f0;
    background: white;
}

/* Document styling inside preview */
.preview-content * {
    color: #1e293b;
    margin-bottom: 0.5em;
}

.preview-content h1, .preview-content h2, .preview-content h3 {
    color: #0f172a;
    font-weight: 700;
}

.preview-content p {
    margin-bottom: 1em;
}

.preview-content strong {
    font-weight: 700;
}

.preview-content u, .preview-content .student-blank {
    text-decoration: underline;
    font-weight: 700;
}

.preview-content .teacher-keyword {
    color: #4f46e5; /* Premium Blue */
    font-weight: 800;
    font-size: 1.1em;
}

/* Custom scrollbar for preview */
.preview-content::-webkit-scrollbar {
    width: 6px;
}

.preview-content::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.preview-content::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.preview-content::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

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

@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}

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

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

/* Glassmorphism background elements */
.blob {
    position: absolute;
    width: 500px;
    height: 500px;
    background: linear-gradient(to right, var(--primary), var(--secondary));
    filter: blur(80px);
    border-radius: 50%;
    z-index: -1;
    opacity: 0.2;
    animation: float 20s infinite alternate;
}

.blob-1 { top: -100px; left: -100px; }
.blob-2 { bottom: -100px; right: -100px; animation-delay: -5s; }

@keyframes float {
    from { transform: translate(0, 0) scale(1); }
    to { transform: translate(100px, 50px) scale(1.1); }
}
