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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 40px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
}

header p {
    opacity: 0.9;
    font-size: 1.1em;
}

main {
    padding: 40px;
}

.step-section {
    margin-bottom: 40px;
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.step-section h2 {
    color: #667eea;
    margin-bottom: 30px;
    font-size: 1.8em;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
}

.input-options {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 25px;
    align-items: stretch;
    justify-content: center;
}

.divider {
    display: none;
}

.option-card {
    background: #f8f9fa;
    border: 2px solid #e9ecef;
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    flex: 1;
    min-width: 280px;
    max-width: 380px;
}

.option-card h3 {
    color: #333;
    margin-bottom: 10px;
    font-size: 1.3em;
}

.option-card p {
    color: #666;
    margin-bottom: 20px;
}

input[type="file"] {
    display: block;
    margin: 20px auto;
    padding: 10px;
    border: 2px dashed #667eea;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    width: 100%;
}

textarea {
    width: 100%;
    padding: 15px;
    border: 2px solid #e9ecef;
    border-radius: 10px;
    font-family: inherit;
    font-size: 1em;
    resize: vertical;
    margin-bottom: 15px;
}

textarea:focus {
    outline: none;
    border-color: #667eea;
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 10px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin: 5px;
}

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

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.btn-success {
    background: #28a745;
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #218838;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: translateY(-2px);
}

.status-message {
    margin-top: 15px;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9em;
}

.status-message.success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.status-message.error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.config-form {
    background: #f8f9fa;
    padding: 30px;
    border-radius: 15px;
    border: 1px solid #e9ecef;
}

.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #333;
    font-size: 1.05em;
}

.form-group input[type="text"],
.form-group input[type="date"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1em;
    font-family: inherit;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.preview-container {
    background: #f8f9fa;
    border-radius: 15px;
    overflow: hidden;
}

.preview-header {
    background: white;
    padding: 20px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.preview-header h3 {
    color: #333;
    font-size: 1.5em;
}

.preview-actions {
    display: flex;
    gap: 10px;
}

.exam-preview {
    padding: 40px;
    background: white;
    margin: 20px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    font-family: 'Times New Roman', serif;
    position: relative;
    overflow: visible;
}

.exam-preview h1 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
    color: #333;
    position: relative;
    z-index: 1;
}

.exam-preview .exam-header {
    border-bottom: 2px solid #333;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.exam-preview .exam-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 20px;
    font-size: 0.95em;
}

.exam-preview .exam-info p {
    margin: 5px 0;
}

.exam-preview .question {
    margin-bottom: 40px;
    page-break-inside: avoid;
    position: relative;
    padding: 0;
    min-height: 100px;
}

.exam-preview .question-number {
    font-weight: bold;
    font-size: 1.1em;
    color: #333;
    margin-bottom: 8px;
}

.exam-preview .question-text {
    margin-bottom: 15px;
    line-height: 1.6;
    padding-right: 20px;
}

.exam-preview .answer-space {
    border: 1px solid #ddd;
    min-height: 80px;
    padding: 10px;
    background: #fafafa;
    border-radius: 5px;
}

.exam-preview .score-circle {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 280px !important;
    height: 280px !important;
    border-radius: 50%;
    border: 8px solid #667eea !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    z-index: 1000;
}

.exam-preview .scoring {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 2px solid #333;
}

.exam-preview .scoring h3 {
    margin-bottom: 15px;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 60px;
    height: 60px;
    border: 5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    color: white;
    margin-top: 20px;
    font-size: 1.2em;
}

footer {
    background: #f8f9fa;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.9em;
}

@media (max-width: 768px) {
    .input-options {
        grid-template-columns: 1fr;
    }

    .option-card {
        min-width: 100%;
        max-width: 100%;
    }

    .divider {
        display: none;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .preview-header {
        flex-direction: column;
        gap: 15px;
    }

    .preview-actions {
        flex-direction: column;
        width: 100%;
    }

    .preview-actions .btn {
        width: 100%;
    }
}