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

body {
    font-family: 'Nata Sans', sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.upgrade-banner {
    background: linear-gradient(135deg, #5d4037 0%, #6d4c41 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(93, 64, 55, 0.2);
}

.btn-upgrade {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    padding: 10px 20px;
    text-decoration: none;
    border-radius: 25px;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.btn-upgrade:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

/* Upload Section */
.upload-section {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    max-width: 50%;
    transition: all 0.3s ease;
}

.upload-section.processing {
    max-width: 100%;
}

.upload-section h2 {
    color: #5d4037;
    margin-bottom: 10px;
    font-size: 1.8rem;
    font-weight: 600;
}

.upload-section p {
    color: #666;
    margin-bottom: 20px;
}

.upload-box {
    border: 3px dashed #ddd;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 20px;
    position: relative;
    overflow: hidden;
}

.upload-box:hover {
    border-color: #5d4037;
    background-color: #f9f7f6;
    transform: translateY(-2px);
}

.upload-box.dragover {
    border-color: #5d4037;
    background-color: #f0ebe9;
    transform: scale(1.02);
}

.upload-box input[type="file"] {
    display: none;
}

.upload-label {
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    color: #666;
    font-size: 1.1rem;
    transition: color 0.3s ease;
}

.upload-label:hover {
    color: #5d4037;
}

.upload-label i {
    font-size: 3rem;
    color: #5d4037;
    opacity: 0.7;
}

.sample-upload-container {
    display: none;
    animation: slideDown 0.3s ease-out;
}

.sample-upload-container.show {
    display: block;
}

.add-sample-btn {
    background: transparent;
    border: 2px dashed #ccc;
    color: #666;
    padding: 15px 20px;
    border-radius: 10px;
    cursor: pointer;
    width: 100%;
    font-size: 1rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.add-sample-btn:hover {
    border-color: #5d4037;
    color: #5d4037;
    background-color: #f9f7f6;
}

.btn-upload {
    background: linear-gradient(135deg, #5d4037 0%, #6d4c41 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 20px auto 0;
    box-shadow: 0 4px 15px rgba(93, 64, 55, 0.3);
}

.btn-upload:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(93, 64, 55, 0.4);
}

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

.spinner {
    border: 2px solid transparent;
    border-top: 2px solid white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

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

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        max-height: 500px;
        transform: translateY(0);
    }
}

/* Main Content Area */
.main-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    display: none;
}

.main-content.show {
    display: grid;
}

@media (min-width: 768px) {
    .main-content.show {
        grid-template-columns: 350px 1fr;
    }
}

/* Chapter Selection */
.chapter-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    height: fit-content;
}

.chapter-panel h3 {
    color: #5d4037;
    margin-bottom: 20px;
    font-size: 1.4rem;
    font-weight: 600;
}

.select-all-container {
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin-bottom: 20px;
}

.form-check {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.form-check-input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #5d4037;
}

.form-check-label {
    cursor: pointer;
    font-weight: 500;
    color: #333;
}

.chapter-list {
    max-height: 400px;
    overflow-y: auto;
    padding-right: 10px;
}

.chapter-list::-webkit-scrollbar {
    width: 6px;
}

.chapter-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chapter-list::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.chapter-list::-webkit-scrollbar-thumb:hover {
    background: #999;
}

.part-name {
    font-weight: bold;
    color: #5d4037;
    margin: 15px 0 10px 0;
    font-size: 1.1rem;
    padding-bottom: 5px;
    border-bottom: 2px solid #f0f0f0;
}

/* Control Panel */
.control-panel {
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.control-panel h3 {
    color: #5d4037;
    margin-bottom: 25px;
    font-size: 1.4rem;
    font-weight: 600;
}

.question-types-grid {
    display: grid;
    gap: 20px;
    margin-bottom: 30px;
}

.question-type-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    border: 2px solid transparent;
    transition: all 0.3s ease;
}

.question-type-card.active {
    border-color: #5d4037;
    background: #f9f7f6;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(93, 64, 55, 0.1);
}

.question-type-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.question-type-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    color: #333;
}

.question-count-badge {
    background: #5d4037;
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-top: 15px;
}

.slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: #ddd;
    outline: none;
    transition: background 0.3s ease;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #5d4037;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 8px rgba(93, 64, 55, 0.1);
}

.slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #5d4037;
    cursor: pointer;
    border: none;
}

.slider-value {
    font-weight: 600;
    color: #5d4037;
    min-width: 30px;
    text-align: center;
}

.generation-options {
    border-top: 2px solid #f0f0f0;
    padding-top: 25px;
}

.options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

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

.form-select {
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.form-select:focus {
    outline: none;
    border-color: #5d4037;
    box-shadow: 0 0 0 3px rgba(93, 64, 55, 0.1);
}

.btn-generate {
    background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
    color: white;
    border: none;
    padding: 15px 30px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
}

.btn-generate:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

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

/* Editor Section */
.editor-section {
    grid-column: 1 / -1;
    background: white;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
    display: none;
}

.editor-section.show {
    display: block;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.editor-title {
    color: #5d4037;
    font-size: 1.4rem;
    font-weight: 600;
}

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

.btn-action {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-action.btn-primary {
    background: #5d4037;
    color: white;
}

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

.btn-action.btn-danger {
    background: #dc3545;
    color: white;
}

.btn-action:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

#editor {
    min-height: 500px;
    border: 2px solid #f0f0f0;
    border-radius: 8px;
}

/* Alert Messages */
.alert {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 20px;
    font-weight: 500;
}

.alert-info {
    background: #e3f2fd;
    color: #0277bd;
    border-left: 4px solid #2196f3;
}

.alert-danger {
    background: #ffebee;
    color: #c62828;
    border-left: 4px solid #f44336;
}

.alert-success {
    background: #e8f5e8;
    color: #2e7d32;
    border-left: 4px solid #4caf50;
}

/* Placeholder text */
.placeholder-text {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 40px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 2px dashed #ddd;
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
    .upload-section {
        max-width: 100%;
        padding: 20px;
    }

    .upgrade-banner {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

    .main-content {
        gap: 20px;
    }

    .chapter-panel,
    .control-panel {
        padding: 20px;
    }

    .options-grid {
        grid-template-columns: 1fr;
    }

    .editor-actions {
        justify-content: center;
    }
}

/* Hide processed upload section */
.upload-section.hidden {
    display: none;
}
