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

:root {
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --secondary-gradient: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    --success-gradient: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    --dark-gradient: linear-gradient(180deg, #0a0a0a 0%, #1a1a2e 100%);
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --accent-color: #667eea;
    --accent-glow: rgba(102, 126, 234, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--dark-gradient);
    min-height: 100vh;
    padding: 2rem;
    color: #ffffff;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(118, 75, 162, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 80%, rgba(240, 147, 251, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

header {
    text-align: center;
    color: #ffffff;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 800;
    letter-spacing: -0.5px;
}

header p {
    font-size: 1.1rem;
    opacity: 0.8;
    color: #aaa;
}

.header-subtitle {
    margin-top: 0.5rem;
    animation: fadeInDown 1s ease-out 0.3s both;
}

.header-decoration {
    width: 60px;
    height: 4px;
    background: var(--primary-gradient);
    margin: 1.5rem auto 0;
    border-radius: 2px;
    animation: fadeInDown 1s ease-out 0.5s both;
}

.card {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--glass-border);
    border: 1px solid var(--glass-border);
    transition: all 0.3s ease;
    animation: fadeInUp 0.6s ease-out;
}

.card:hover {
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(102, 126, 234, 0.2);
    border-color: rgba(102, 126, 234, 0.3);
}

.card h2 {
    margin-bottom: 1.5rem;
    color: #ffffff;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-description {
    color: #aaa;
    font-size: 0.95rem;
    margin-bottom: 1.5rem;
    margin-top: -1rem;
    opacity: 0.9;
}

.hidden {
    display: none !important;
}

.error {
    border-left: 4px solid #e74c3c;
}

/* Upload Area */
.upload-area {
    border: 3px dashed rgba(102, 126, 234, 0.3);
    border-radius: 16px;
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-bottom: 1.5rem;
    background: rgba(15, 15, 15, 0.5);
    position: relative;
    overflow: hidden;
}

.upload-area::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--primary-gradient);
    opacity: 0.05;
    transition: left 0.5s ease;
}

.upload-area:hover::before {
    left: 0;
}

.upload-area:hover {
    border-color: rgba(102, 126, 234, 0.6);
    background: rgba(26, 26, 26, 0.8);
    transform: translateY(-2px);
    box-shadow: 0 15px 30px rgba(102, 126, 234, 0.15);
}

.upload-area.dragover {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.02);
}

.upload-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 1rem;
    color: #ffffff;
    filter: drop-shadow(0 0 20px rgba(102, 126, 234, 0.3));
    transition: all 0.3s ease;
}

.upload-area:hover .upload-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 30px rgba(102, 126, 234, 0.5));
}

.upload-content p {
    color: #aaa;
    margin-bottom: 0.5rem;
}

.file-name {
    color: #ffffff;
    font-weight: 600;
    display: block;
    margin-top: 0.5rem;
}

.upload-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

.question-count-section {
    margin-bottom: 1.5rem;
}

.question-count-section label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #ffffff;
}

.question-count-input {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.question-count-input .text-input {
    flex: 1;
    max-width: 150px;
}

.question-count-range {
    color: #aaa;
    font-size: 0.9rem;
}

/* Buttons */
.btn {
    padding: 1rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:active::before {
    width: 300px;
    height: 300px;
}

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

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: var(--success-gradient);
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(79, 172, 254, 0.3);
}

.btn-success:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(79, 172, 254, 0.4);
}

.btn-secondary {
    background: rgba(51, 51, 51, 0.8);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(68, 68, 68, 0.9);
    border-color: rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.btn-info {
    background: var(--secondary-gradient);
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(240, 147, 251, 0.3);
}

.btn-info:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(240, 147, 251, 0.4);
}

/* Loader */
.loader {
    text-align: center;
    padding: 3rem;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(102, 126, 234, 0.2);
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem;
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.3);
}

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

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

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

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 25px 50px rgba(102, 126, 234, 0.4);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

.loader p {
    color: #aaa;
    margin-bottom: 0.5rem;
}

.loading-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: #ffffff;
}

.loading-progress {
    width: 100%;
    max-width: 300px;
    height: 6px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 3px;
    margin: 2rem auto 0;
    overflow: hidden;
}

.progress-bar {
    width: 0%;
    height: 100%;
    background: var(--primary-gradient);
    border-radius: 3px;
    animation: progressAnimation 2s ease-in-out infinite;
}

@keyframes progressAnimation {
    0% {
        width: 0%;
        transform: translateX(-100%);
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
        transform: translateX(100%);
    }
}

.sub-text {
    color: #888;
    font-size: 0.9rem;
}

/* Quiz Styles */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid rgba(102, 126, 234, 0.2);
}

.quiz-subtitle {
    color: #aaa;
    font-size: 0.9rem;
    margin-top: -1rem;
    margin-bottom: 1rem;
}

.quiz-stats {
    display: flex;
    gap: 1rem;
    color: #aaa;
}

.quiz-stats span {
    font-weight: 600;
}

.quiz-info {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    color: #aaa;
}

.quiz-id-badge {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

.quiz-id-badge span {
    font-family: monospace;
}

/* Load Quiz Form */
.load-quiz-form {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.text-input {
    flex: 1;
    padding: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
    background: rgba(15, 15, 15, 0.8);
    color: #ffffff;
}

.text-input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
    background: rgba(26, 26, 26, 0.9);
}

/* Quizzes List */
.quizzes-list {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.quiz-item {
    background: rgba(15, 15, 15, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    border-left: 4px solid #667eea;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
}

.quiz-item:hover {
    background: rgba(26, 26, 26, 0.9);
    transform: translateX(8px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.15);
}

.quiz-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.quiz-item-id {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    font-family: monospace;
}

.quiz-item-name {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.quiz-item-meta {
    color: #aaa;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.quiz-item-actions {
display: flex;
gap: 0.5rem;
}

.quiz-item-actions .btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

.admin-badge {
    background: var(--secondary-gradient);
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    box-shadow: 0 5px 15px rgba(240, 147, 251, 0.3);
}

.delete-btn {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.3) !important;
}

.delete-btn:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.4) !important;
}

/* Manual Quiz Form */
.manual-quiz-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-weight: 600;
    color: #ffffff;
    font-size: 0.95rem;
}

.manual-question-card {
    background: rgba(26, 26, 26, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border-left: 4px solid #667eea;
    position: relative;
    transition: all 0.3s ease;
}

.manual-question-card:hover {
    background: rgba(34, 34, 34, 0.9);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.1);
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.question-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #ffffff;
}

.question-type-select {
    padding: 0.5rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    background: rgba(15, 15, 15, 0.8);
    color: #ffffff;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.question-type-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.15);
}

.remove-question-btn {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(245, 87, 108, 0.3);
}

.remove-question-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.4);
}

.option-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.option-input-group input[type="text"] {
    flex: 1;
    padding: 0.75rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 10px;
    background: rgba(15, 15, 15, 0.8);
    color: #ffffff;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.option-input-group input[type="text"]:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.15);
    background: rgba(26, 26, 26, 0.9);
}

.add-option-btn {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
}

.add-option-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
}

.manual-question-text {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    background: rgba(15, 15, 15, 0.8);
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 1rem;
    transition: all 0.3s ease;
}

.manual-question-text:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
    background: rgba(26, 26, 26, 0.9);
}

.manual-correct-answer {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    background: rgba(15, 15, 15, 0.8);
    color: #ffffff;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.3s ease;
}

.manual-correct-answer:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
    background: rgba(26, 26, 26, 0.9);
}

.ai-verify-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ai-verify-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: #ffffff;
}

.ai-verify-checkbox label {
    color: #aaa;
    font-size: 0.9rem;
}

.question-card {
    background: rgba(15, 15, 15, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    border-left: 4px solid #667eea;
    transition: all 0.3s ease;
}

.question-card:hover {
    background: rgba(26, 26, 26, 0.9);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.1);
}

.question-card.ai-verify {
    border-left-color: #888;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.question-number {
    background: var(--primary-gradient);
    color: #ffffff;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
}

.question-type {
    font-size: 0.8rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-weight: 600;
}

.type-qcm {
    background: #333;
    color: #ffffff;
}

.type-text {
    background: #333;
    color: #ffffff;
}

.type-true-false {
    background: #333;
    color: #ffffff;
}

.ai-badge {
    background: #333;
    color: #ffffff;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    margin-left: 0.5rem;
}

.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #ffffff;
}

/* QCM Options */
.options-grid {
    display: grid;
    gap: 0.75rem;
}

/* True/False Grid */
.true-false-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.option-label {
    display: flex;
    align-items: center;
    padding: 1rem;
    background: rgba(26, 26, 26, 0.8);
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: #ffffff;
}

.option-label:hover {
    border-color: rgba(102, 126, 234, 0.5);
    background: rgba(34, 34, 34, 0.9);
    transform: translateX(4px);
}

.option-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 1rem;
    accent-color: #ffffff;
}

.option-label.selected {
    border-color: #667eea;
    background: rgba(102, 126, 234, 0.15);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
}

/* Text Answer */
.text-answer {
    width: 100%;
    padding: 1rem;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 12px;
    font-size: 1rem;
    font-family: inherit;
    resize: vertical;
    min-height: 100px;
    transition: all 0.3s ease;
    background: rgba(15, 15, 15, 0.8);
    color: #ffffff;
}

.text-answer:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.2);
    background: rgba(26, 26, 26, 0.9);
}

/* Quiz Actions */
.quiz-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid rgba(102, 126, 234, 0.2);
    flex-wrap: wrap;
}

/* Results */
.results-summary {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 3rem;
    margin-bottom: 2rem;
    padding: 2rem;
    background: rgba(15, 15, 15, 0.8);
    border-radius: 20px;
    border: 1px solid rgba(102, 126, 234, 0.2);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.score-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: var(--primary-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-size: 2rem;
    font-weight: bold;
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.3);
    animation: pulse 2s ease-in-out infinite;
}

.stats p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: #aaa;
}

.stats strong {
    color: #ffffff;
}

.result-item {
    background: rgba(15, 15, 15, 0.8);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
}

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

.result-item.correct {
    border-left: 4px solid #4facfe;
    background: rgba(79, 172, 254, 0.05);
}

.result-item.incorrect {
    border-left: 4px solid #f5576c;
    background: rgba(245, 87, 108, 0.05);
}

.result-item.partial {
    border-left: 4px solid #f093fb;
    background: rgba(240, 147, 251, 0.05);
}

.result-question {
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: #ffffff;
}

.result-answer {
    margin-bottom: 0.5rem;
    color: #aaa;
}

.result-feedback {
    background: #1a1a1a;
    padding: 1rem;
    border-radius: 6px;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    color: #aaa;
}

/* Responsive */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 1.8rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .quiz-header {
        flex-direction: column;
        gap: 1rem;
    }
    
    .quiz-actions {
        flex-direction: column;
    }
    
    .results-summary {
        flex-direction: column;
        gap: 1.5rem;
    }
}
