/**
 * Assignment Generator Plugin Styles - Version 4.0
 * Component-based for 80/40 marks, custom format for others
 */

/* ================ RESET & BASE STYLES ================ */
#assignment-generator * {
    box-sizing: border-box;
}

/* ================ BACK TO TOOLS LINK ================ */
#back-to-tools {
    display: inline-flex;
    align-items: center;
    margin-bottom: 20px;
    text-decoration: none;
    color: #0073aa;
    font-weight: 500;
    transition: color 0.3s ease;
}

#back-to-tools:hover {
    color: #00567d;
}

#back-to-tools svg {
    margin-right: 8px;
}

/* ================ MAIN CONTAINER ================ */
.ct-container-full {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh !important;
    width: 100%;
    padding-top: 0;
    padding-bottom: 0;
}

#assignment-generator {
    width: 100%;
    max-width: 1100px;
    margin: 10px auto;
    padding: 10px;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    background-color: #ffffff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    box-sizing: border-box;
}

#assignment-generator h2 {
    text-align: center;
    color: #1a1a1a;
    margin-bottom: 30px;
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

/* ================ CONFIG SECTION ================ */
.config-section {
    margin-bottom: 25px;
    padding: 20px;
    background: #fafbfc;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.config-section:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.config-section h3 {
    margin: 0 0 18px 0;
    color: #202124;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #0073aa;
    padding-bottom: 10px;
}

.format-info {
    margin: 0 0 15px 0;
    padding: 10px 15px;
    background: #e3f2fd;
    border-left: 4px solid #2196F3;
    border-radius: 4px;
    font-size: 13px;
    color: #1565C0;
    font-weight: 500;
}

.no-components {
    padding: 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* ================ FORM LAYOUT ================ */
.form-row-full {
    margin-bottom: 15px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 15px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field.full-width {
    width: 100%;
}

.form-field label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #5f6368;
    font-size: 13px;
    letter-spacing: 0.2px;
}

.form-field select,
.form-field input[type="text"],
.form-field input[type="number"],
.form-field textarea {
    padding: 10px 14px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s ease;
    background: #ffffff;
    color: #202124;
}

.form-field select:focus,
.form-field input:focus,
.form-field textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 4px rgba(0, 115, 170, 0.08);
}

.form-field textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
    line-height: 1.5;
}

/* ================ FILE UPLOAD STYLES - COMPACT ================ */
.file-upload-container {
    margin-top: 16px;
}

.file-upload-container > label {
    display: block;
    font-weight: 500;
    margin-bottom: 8px;
    color: #5f6368;
    font-size: 13px;
}

.file-upload-area {
    border: 2px dashed #dadce0;
    border-radius: 6px;
    padding: 16px 14px;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.file-upload-area:hover {
    border-color: #0073aa;
    background: #f1f8fb;
}

.file-upload-area.drag-over {
    border-color: #28a745;
    background: #e8f5e9;
}

.file-upload-area input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 90%;
    height: 90%;
    opacity: 0;
    cursor: pointer;
    z-index: 1;
}

.file-upload-icon {
    margin-bottom: 6px;
}

.file-upload-icon svg {
    width: 32px;
    height: 32px;
    stroke: #5f6368;
    opacity: 0.6;
}

.file-upload-text {
    font-size: 13px;
    color: #5f6368;
    margin: 0 0 4px 0;
    font-weight: 500;
}

.file-or-text {
    font-size: 10px;
    color: #80868b;
    margin: 6px 0;
}

.file-choose-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 16px;
    background: #0073aa;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    z-index: 2;
    text-decoration: none;
}

.file-choose-btn:hover {
    background: #005a87;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 115, 170, 0.25);
}

.file-choose-btn svg {
    width: 13px;
    height: 13px;
    stroke: white;
    fill: none;
}

.file-hint {
    font-size: 9px;
    color: #80868b;
    margin: 8px 0 0 0;
    font-style: italic;
}

#files-preview-container {
    margin-top: 12px;
}

.files-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.file-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #ffffff;
    border: 1px solid #e8eaed;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.file-item:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.file-name {
    flex: 1;
    font-size: 13px;
    color: #202124;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-item .status-ready {
    margin: 0 10px;
    font-size: 16px;
}

.remove-file-btn {
    background: #dc3545;
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.remove-file-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

#files-analysis {
    margin-top: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
}

#files-analysis .processing {
    color: #ff9800;
}

#files-analysis .success {
    color: #28a745;
}

#files-analysis .warning {
    color: #dc3545;
}

/* ================ COMPONENT-BASED STYLES ================ */
#components-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.component-section {
    background: #ffffff;
    border: 2px solid #e8eaed;
    border-radius: 10px;
    padding: 18px;
    transition: all 0.3s ease;
}

.component-section:hover {
    border-color: #0073aa;
    box-shadow: 0 3px 8px rgba(0, 115, 170, 0.12);
}

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

.component-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #202124;
    display: flex;
    align-items: center;
    gap: 12px;
}

.section-badge {
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.component-marks {
    background: #e3f2fd;
    color: #1565C0;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
}

.component-question-types {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.component-question-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.component-question-item:hover {
    background: #e3f2fd;
    border-color: #2196F3;
}

.component-question-item label {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    margin: 0;
    font-size: 13px;
}

.component-type-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #0073aa;
}

.type-label {
    font-weight: 600;
    color: #202124;
}

.type-marks {
    font-size: 11px;
    color: #5f6368;
    font-weight: 500;
}

.component-count-input {
    width: 70px;
    padding: 6px 10px;
    border: 1px solid #dadce0;
    border-radius: 6px;
    text-align: center;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.component-count-input:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
}

.component-count-input:disabled {
    background: #f5f5f5;
    color: #999;
    cursor: not-allowed;
}

/* ================ CUSTOM FORMAT STYLES (Original) ================ */
.section-toggle-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f1f3f4, #e8eaed);
    border-radius: 8px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
}

.section-toggle-header:hover {
    background: linear-gradient(135deg, #e8eaed, #dadce0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.section-toggle-header h3 {
    margin: 0;
    border: none;
    padding: 0;
    color: #202124;
    font-size: 15px;
}

.toggle-icon {
    font-size: 18px;
    font-weight: bold;
    color: #0073aa;
    transition: transform 0.3s ease;
}

.section-toggle-header.active .toggle-icon {
    transform: rotate(180deg);
}

.section-config {
    margin-bottom: 18px;
    padding: 14px;
    background: #ffffff;
    border-left: 4px solid #0073aa;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.section-header-config {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.section-header-config h4 {
    margin: 0;
    color: #202124;
    font-size: 14px;
    font-weight: 600;
}

.section-total {
    background: #0073aa;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

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

.question-type-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.question-type-item:hover {
    border-color: #0073aa;
    background: #f1f8fb;
    box-shadow: 0 1px 3px rgba(0, 115, 170, 0.1);
}

.question-type-item.disabled {
    opacity: 0.5;
    pointer-events: none;
    background: #f5f5f5;
}

.question-type-item label {
    flex: 1;
    margin: 0;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #202124;
}

.question-type-item input[type="checkbox"] {
    cursor: pointer;
    width: 16px;
    height: 16px;
}

.count-input {
    width: 60px;
    padding: 5px 8px;
    border: 1px solid #dadce0;
    border-radius: 4px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
}

.count-input:focus {
    outline: none;
    border-color: #0073aa;
}

/* ================ TOTAL MARKS DISPLAY ================ */
.total-marks-display {
    margin-top: 20px;
    padding: 18px 24px;
    background: linear-gradient(135deg, #0073aa, #005a87);
    color: white;
    border-radius: 12px;
    text-align: center;
    font-size: 16px;
    font-weight: bold;
    box-shadow: 0 4px 10px rgba(0, 115, 170, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.total-label {
    font-size: 16px;
    font-weight: 600;
}

.total-value {
    font-size: 32px;
    font-weight: 700;
    padding: 0 12px;
}

.total-value.success {
    color: #4CAF50;
}

.total-value.warning {
    color: #ff9800;
}

.target-marks {
    font-size: 14px;
    font-weight: 500;
    opacity: 0.9;
}

/* ================ GENERATE BUTTON ================ */
#generate-assignment {
    width: 100%;
    padding: 14px 20px;
    background: linear-gradient(135deg, #28a745, #20853a);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 3px 8px rgba(40, 167, 69, 0.25);
}

#generate-assignment:hover {
    background: linear-gradient(135deg, #20853a, #1a6e2f);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px rgba(40, 167, 69, 0.35);
}

#generate-assignment:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

#generate-assignment svg {
    width: 18px;
    height: 18px;
}

.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 3px solid white;
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
    display: inline-block;
}

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

/* ================ PROGRESS BAR ================ */
#progress-container {
    margin: 20px 0;
    padding: 18px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e8eaed;
    display: none;
}

.progress-bar-wrapper {
    width: 100%;
}

.progress-bar-container {
    width: 100%;
    height: 28px;
    background: #e8eaed;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50, #66BB6A);
    border-radius: 14px;
    width: 0%;
    transition: width 0.5s ease, background 0.5s ease;
    position: relative;
    overflow: hidden;
}

.progress-bar::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0%,
        rgba(255, 255, 255, 0.3) 50%,
        rgba(255, 255, 255, 0) 100%
    );
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.progress-percentage {
    font-size: 15px;
    font-weight: bold;
    color: #0073aa;
}

.progress-message {
    font-size: 13px;
    color: #5f6368;
    font-weight: 500;
}

/* ================ TAB CONTAINER ================ */
.tab-container {
    margin-top: 30px;
    display: none;
}

.tab-navigation {
    display: flex;
    gap: 0;
    border-bottom: 2px solid #e8eaed;
    margin-bottom: 20px;
}

.tab-button {
    padding: 12px 20px;
    background: #f8f9fa;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: #5f6368;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab-button:hover {
    background: #e8eaed;
    color: #202124;
}

.tab-button.active {
    background: white;
    color: #0073aa;
    border-bottom-color: #0073aa;
}

.tab-button svg {
    width: 14px;
    height: 14px;
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

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

/* ================ OUTPUT STYLES ================ */
#assignment-output,
#answer-sheet-output {
    padding: 20px;
    background: #ffffff;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    min-height: 200px;
}

/* CBSE Question Paper Styles */
.cbse-question-paper {
    font-family: 'Times New Roman', serif;
    line-height: 1.6;
}

.paper-header {
    text-align: center;
    border-bottom: 2px solid #000;
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.paper-title {
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 12px;
    color: #000;
}

.paper-info-row {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    margin-top: 10px;
    flex-wrap: wrap;
    gap: 15px;
}

.paper-info-row span {
    font-weight: 500;
}

.paper-topic {
    margin-top: 10px;
    font-size: 13px;
}

.section-container,
.component-section {
    margin-bottom: 25px;
}

.section-header {
    background: linear-gradient(135deg, #f0f0f0, #e8e8e8);
    padding: 12px 20px;
    font-weight: bold;
    border: 1px solid #000;
    border-left: 5px solid #0073aa;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-radius: 4px;
}

.section-header h3 {
    margin: 0;
    font-size: 14px;
    color: #000;
}

.section-marks-badge {
    background: #0073aa;
    color: #fff;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.question-type-group {
    margin-bottom: 20px;
}

.question-type-heading {
    font-size: 13px;
    font-weight: 600;
    margin: 15px 0 12px 0;
    padding: 8px 12px;
    background: #f8f9fa;
    border-left: 4px solid #0073aa;
    color: #202124;
}

.section-divider {
    border: none;
    border-top: 1px solid #ccc;
    margin: 20px 0;
}

.question-box {
    margin-bottom: 20px;
    padding: 15px;
    border: 1px solid #ddd;
    border-left: 4px solid #0073aa;
    border-radius: 6px;
    background: #fafafa;
}

.question-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
}

.question-number {
    font-weight: bold;
    color: #000;
    font-size: 14px;
}

.question-marks {
    font-weight: bold;
    font-size: 12px;
    background: #f0f0f0;
    padding: 3px 10px;
    border-radius: 4px;
    color: #333;
}

.question-text {
    margin-bottom: 12px;
    color: #000;
    font-size: 14px;
}

.question-text p {
    margin: 0;
    white-space: pre-wrap;
    line-height: 1.6;
}

.question-options {
    margin-left: 20px;
    margin-top: 10px;
}

.option-item {
    margin: 8px 0;
    font-size: 14px;
}

.option-letter {
    font-weight: 600;
    color: #0073aa;
}

.option-text {
    color: #000;
}

.matrix-match-container {
    margin: 15px 0;
}

.matrix-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.matrix-table th,
.matrix-table td {
    border: 1px solid #000;
    padding: 10px;
    text-align: left;
    font-size: 13px;
}

.matrix-table th {
    background: #f0f0f0;
    font-weight: 600;
}

.sub-questions {
    background: #f9f9f9;
    padding: 15px;
    margin-top: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.sub-questions-label {
    margin-bottom: 10px;
    font-weight: 600;
    color: #000;
}

.sub-question {
    margin: 10px 0;
    padding-left: 10px;
    font-size: 14px;
}

.sub-part {
    font-weight: 600;
    color: #0073aa;
    margin-right: 5px;
}

.sub-marks {
    font-size: 11px;
    color: #666;
    margin-left: 5px;
}

/* Answer Sheet Styles */
.answer-sheet {
    font-family: Arial, sans-serif;
}

.answer-sheet-title {
    text-align: center;
    font-size: 18px;
    font-weight: bold;
    border-bottom: 2px solid #000;
    padding-bottom: 12px;
    margin-bottom: 25px;
    color: #000;
}

.answer-section {
    margin-bottom: 25px;
}

.answer-section-title {
    background: linear-gradient(135deg, #f0f0f0, #e8e8e8);
    padding: 10px 15px;
    border: 1px solid #000;
    border-left: 5px solid #28a745;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 15px;
    border-radius: 4px;
}

.answer-type-heading {
    font-size: 12px;
    font-weight: 600;
    margin: 12px 0 10px 0;
    padding: 6px 10px;
    background: #f8f9fa;
    border-left: 3px solid #28a745;
    color: #202124;
}

.answer-item {
    margin-bottom: 15px;
    padding: 15px;
    border: 1px solid #ddd;
    border-left: 4px solid #28a745;
    border-radius: 6px;
    background: #fafafa;
}

.answer-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

.question-num {
    font-weight: bold;
    color: #000;
    font-size: 14px;
}

.question-marks-badge {
    background: #28a745;
    color: #fff;
    padding: 3px 10px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.question-preview {
    font-size: 12px;
    color: #666;
    margin-bottom: 10px;
    font-style: italic;
}

.answer-content {
    margin-bottom: 10px;
    font-size: 14px;
}

.answer-content strong {
    color: #0073aa;
}

.editable-answer {
    display: inline-block;
    padding: 8px;
    background: #fff;
    border: 1px dashed #ccc;
    border-radius: 4px;
    min-width: 200px;
    cursor: text;
}

.editable-answer:focus {
    outline: 2px solid #0073aa;
    background: #fffef0;
}

.case-study-answers {
    margin-left: 20px;
}

.sub-answer {
    margin: 10px 0;
    padding: 8px 0 8px 15px;
    border-left: 3px solid #28a745;
}

.marking-points {
    background: #fffef0;
    padding: 10px;
    border: 1px solid #ffc107;
    margin-top: 10px;
    font-size: 13px;
    border-radius: 4px;
}

.marking-points strong {
    color: #ff6b00;
}

.marking-points ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.marking-points li {
    margin: 5px 0;
    cursor: text;
}

.marking-points li:focus {
    outline: 1px dashed #ffc107;
    background: #fff;
}

/* ================ ACTION BUTTONS ================ */
#assignment-actions,
#answer-sheet-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
}

#assignment-actions button,
#answer-sheet-actions button {
    padding: 9px 18px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#copy-assignment,
#copy-answer-sheet {
    background: linear-gradient(135deg, #4CAF50, #388e3c);
    color: white;
}

#copy-assignment:hover,
#copy-answer-sheet:hover {
    background: linear-gradient(135deg, #388e3c, #2e7d32);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(76, 175, 80, 0.3);
}

#print-assignment,
#print-answer-sheet {
    background: linear-gradient(135deg, #2196F3, #1976D2);
    color: white;
}

#print-assignment:hover,
#print-answer-sheet:hover {
    background: linear-gradient(135deg, #1976D2, #1565C0);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(33, 150, 243, 0.3);
}

#clear-assignment {
    background: linear-gradient(135deg, #f44336, #d32f2f);
    color: white;
}

#clear-assignment:hover {
    background: linear-gradient(135deg, #d32f2f, #c62828);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(244, 67, 54, 0.3);
}

#save-assignment,
#save-answer-sheet {
    background: linear-gradient(135deg, #FF9800, #F57C00);
    color: white;
}

#save-assignment:hover,
#save-answer-sheet:hover {
    background: linear-gradient(135deg, #F57C00, #E65100);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(255, 152, 0, 0.3);
}

#download-docx-assignment,
#download-docx-answer {
    background: linear-gradient(135deg, #607D8B, #455A64);
    color: white;
}

#download-docx-assignment:hover,
#download-docx-answer:hover {
    background: linear-gradient(135deg, #455A64, #37474F);
    transform: translateY(-1px);
    box-shadow: 0 3px 6px rgba(96, 125, 139, 0.3);
}

#assignment-actions button:disabled,
#answer-sheet-actions button:disabled {
    background: #ccc !important;
    color: #666 !important;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

#assignment-actions button svg,
#answer-sheet-actions button svg {
    width: 14px;
    height: 14px;
}

/* ================ CUSTOM ALERT ================ */
.custom-alert {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 14px 40px 14px 18px;
    border-radius: 8px;
    z-index: 10000;
    max-width: 400px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.3s ease;
    font-size: 13px;
    font-weight: 500;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-close {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

.alert-close:hover {
    opacity: 1;
}

/* ================ RESPONSIVE STYLES ================ */
@media screen and (max-width: 768px) {
    #assignment-generator {
        padding: 15px;
        margin: 10px;
        width: calc(100% - 20px);
        border-radius: 8px;
    }

    #assignment-generator h2 {
        font-size: 20px;
        margin-bottom: 20px;
    }

    .form-row-3,
    .form-row-2 {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .question-types-grid,
    .component-question-types {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .paper-info-row {
        flex-direction: column;
        gap: 8px;
    }

    #assignment-actions,
    #answer-sheet-actions {
        flex-direction: column;
        gap: 8px;
    }

    #assignment-actions button,
    #answer-sheet-actions button {
        width: 100%;
        justify-content: center;
        padding: 12px 16px;
        font-size: 14px;
    }

    .tab-navigation {
        flex-direction: column;
        gap: 8px;
    }

    .tab-button {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }

    .component-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .config-section {
        padding: 15px;
        margin-bottom: 15px;
    }

    .config-section h3 {
        font-size: 16px;
        margin-bottom: 15px;
    }

    .form-field label {
        font-size: 13px;
        margin-bottom: 6px;
    }

    .form-field select,
    .form-field input,
    .form-field textarea {
        font-size: 14px;
        padding: 10px 12px;
    }

    #generate-assignment {
        width: 100%;
        padding: 14px 20px;
        font-size: 16px;
    }

    /* Question paper output */
    .cbse-question-paper,
    .answer-sheet {
        padding: 15px;
    }

    .question-box {
        padding: 12px;
        margin-bottom: 12px;
    }

    .question-text {
        font-size: 14px;
    }

    .question-options {
        margin-left: 10px;
    }

    .section-header h3 {
        font-size: 14px;
    }

    /* Progress bar */
    #progress-container {
        padding: 15px;
    }
}

@media screen and (max-width: 480px) {
    #assignment-generator {
        padding: 12px;
        margin: 5px;
        width: calc(100% - 10px);
        border-radius: 6px;
    }

    #assignment-generator h2 {
        font-size: 18px;
        margin-bottom: 15px;
    }

    #generate-assignment {
        font-size: 15px;
        padding: 12px 16px;
    }

    .config-section {
        padding: 12px;
        border-radius: 6px;
    }

    .config-section h3 {
        font-size: 15px;
    }

    .component-question-types {
        grid-template-columns: 1fr;
    }

    .form-field label {
        font-size: 12px;
    }

    .form-field select,
    .form-field input {
        font-size: 14px;
        padding: 10px;
    }

    #assignment-actions button,
    #answer-sheet-actions button {
        padding: 10px 14px;
        font-size: 13px;
    }

    .tab-button {
        padding: 10px;
        font-size: 13px;
    }

    /* Question paper output */
    .paper-header h2 {
        font-size: 16px;
    }

    .question-box {
        padding: 10px;
    }

    .question-number {
        font-size: 14px;
    }

    .question-text {
        font-size: 13px;
    }

    .question-options {
        margin-left: 8px;
        font-size: 13px;
    }

    .section-header {
        padding: 8px 10px;
    }

    .section-header h3 {
        font-size: 13px;
    }

    .section-marks-badge {
        font-size: 11px;
        padding: 3px 6px;
    }

    /* Answer sheet */
    .answer-item {
        padding: 10px;
    }

    .answer-header {
        flex-wrap: wrap;
        gap: 5px;
    }

    .question-marks-badge {
        font-size: 10px;
        padding: 2px 5px;
    }
}

/* ================ PRINT STYLES ================ */
@media print {
    #assignment-generator,
    #back-to-tools,
    .config-section,
    #generate-assignment,
    #progress-container,
    .tab-navigation,
    #assignment-actions,
    #answer-sheet-actions {
        display: none !important;
    }

    .tab-content.active {
        display: block !important;
    }

    .cbse-question-paper,
    .answer-sheet {
        width: 100%;
        max-width: 100%;
    }

    .question-type-group {
        page-break-inside: avoid;
    }
}

/* ===============================================
   NCERT FORMAT STYLES - ADD TO assignment_generator_styles.css
   =============================================== */

/* NCERT Paper Container */
.ncert-format {
    font-family: 'Noto Sans', 'Noto Sans Devanagari', Arial, sans-serif;
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
    background: #fff;
    line-height: 1.8;
}

/* Paper Header */
.ncert-format .paper-header {
    text-align: center;
    border-bottom: 2px solid #333;
    padding-bottom: 20px;
    margin-bottom: 25px;
}

.ncert-format .paper-header h1 {
    font-size: 24px;
    margin: 0 0 10px 0;
    font-weight: 600;
    color: #1a1a1a;
}

.ncert-format .paper-meta {
    font-size: 14px;
    color: #555;
    margin-top: 10px;
}

/* General Instructions */
.ncert-format .general-instructions {
    background: #f8f9fa;
    border-left: 4px solid #007bff;
    padding: 15px 20px;
    margin: 20px 0;
    border-radius: 4px;
}

.ncert-format .general-instructions h3 {
    font-size: 16px;
    margin: 0 0 10px 0;
    color: #333;
    font-weight: 600;
}

.ncert-format .general-instructions ul {
    margin: 10px 0 0 0;
    padding-left: 20px;
}

.ncert-format .general-instructions li {
    margin: 5px 0;
    font-size: 14px;
    line-height: 1.6;
}

/* Section Headers */
.ncert-format .paper-section {
    margin: 30px 0;
}

.ncert-format .section-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 12px 20px;
    font-size: 18px;
    font-weight: 600;
    border-radius: 6px;
    margin: 25px 0 20px 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

/* Question Container */
.ncert-format .ncert-question {
    margin: 20px 0;
    padding: 15px;
    background: #fff;
    border-left: 3px solid #e0e0e0;
    page-break-inside: avoid;
}

.ncert-format .ncert-question:hover {
    background: #fafbfc;
    border-left-color: #667eea;
}

/* Question Header */
.ncert-format .question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ncert-format .q-number {
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.ncert-format .q-marks {
    background: #e8f4f8;
    color: #2980b9;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
}

/* Question Text */
.ncert-format .question-text {
    font-size: 15px;
    color: #333;
    line-height: 1.8;
    margin: 10px 0;
}

/* MCQ Options */
.ncert-format .options {
    margin: 15px 0 10px 20px;
}

.ncert-format .option {
    padding: 8px 0;
    font-size: 14px;
    line-height: 1.6;
    color: #444;
}

/* Assertion-Reason Questions */
.ncert-format .assertion-reason-question {
    background: #fff8dc;
    border-left: 4px solid #ffd700;
    padding: 15px;
    margin: 10px 0;
    border-radius: 4px;
}

.ncert-format .assertion-reason-question .assertion,
.ncert-format .assertion-reason-question .reason {
    margin: 10px 0;
    padding: 8px 12px;
    background: white;
    border-radius: 4px;
    line-height: 1.7;
}

.ncert-format .assertion-reason-question .assertion {
    border-left: 3px solid #e67e22;
}

.ncert-format .assertion-reason-question .reason {
    border-left: 3px solid #3498db;
}

.ncert-format .assertion-reason-question .options {
    margin-top: 15px;
    margin-left: 10px;
}

/* Internal Choice */
.ncert-format .internal-choice {
    background: #f0f8ff;
    border: 2px dashed #4a90e2;
    padding: 20px;
    margin: 15px 0;
    border-radius: 8px;
}

.ncert-format .internal-choice > p {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 15px;
    text-align: center;
    font-size: 14px;
}

.ncert-format .choice-option {
    background: white;
    padding: 15px;
    margin: 10px 0;
    border-radius: 6px;
    border-left: 4px solid #4a90e2;
    line-height: 1.7;
}

.ncert-format .or-divider {
    text-align: center;
    font-weight: bold;
    font-size: 14px;
    color: #e74c3c;
    margin: 15px 0;
    position: relative;
}

.ncert-format .or-divider::before,
.ncert-format .or-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 40%;
    height: 1px;
    background: #e74c3c;
}

.ncert-format .or-divider::before {
    left: 0;
}

.ncert-format .or-divider::after {
    right: 0;
}

/* Case Study Questions */
.ncert-format .case-study-question {
    background: #f9f9f9;
    border: 2px solid #16a085;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
}

.ncert-format .case-study-context {
    background: #fff;
    padding: 20px;
    border-left: 5px solid #16a085;
    margin-bottom: 20px;
    border-radius: 4px;
    line-height: 1.8;
    font-size: 14px;
    color: #2c3e50;
}

.ncert-format .sub-questions {
    margin-top: 20px;
}

.ncert-format .sub-questions > p {
    font-weight: 600;
    color: #16a085;
    margin-bottom: 15px;
    font-size: 15px;
}

.ncert-format .sub-question {
    background: white;
    padding: 15px;
    margin: 12px 0 12px 20px;
    border-left: 3px solid #95a5a6;
    border-radius: 4px;
    line-height: 1.7;
}

.ncert-format .sub-q-part {
    font-weight: bold;
    color: #16a085;
    font-size: 15px;
}

.ncert-format .sub-marks {
    color: #7f8c8d;
    font-style: italic;
    font-size: 13px;
}

/* Answer Sheet Styles */
.ncert-format.answer-sheet {
    background: #fafafa;
}

.ncert-format .answer-header {
    text-align: center;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.ncert-format .answer-header h1 {
    margin: 0 0 10px 0;
    font-size: 24px;
}

.ncert-format .answer-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 400;
    opacity: 0.9;
}

.ncert-format .answer-section-header {
    background: #34495e;
    color: white;
    padding: 10px 15px;
    font-size: 16px;
    margin: 25px 0 15px 0;
    border-radius: 4px;
}

.ncert-format .answer-item {
    background: white;
    padding: 15px;
    margin: 12px 0;
    border-left: 3px solid #27ae60;
    border-radius: 4px;
    line-height: 1.7;
}

.ncert-format .correct-answer {
    color: #27ae60;
    font-weight: 600;
    background: #e8f8f5;
    padding: 4px 10px;
    border-radius: 4px;
}

.ncert-format .answer-text {
    margin-top: 8px;
    color: #2c3e50;
    line-height: 1.8;
}

.ncert-format .case-study-answers,
.ncert-format .choice-answers {
    margin: 10px 0 0 20px;
}

.ncert-format .sub-answer {
    background: #f8f9fa;
    padding: 10px;
    margin: 8px 0;
    border-left: 2px solid #27ae60;
    border-radius: 3px;
}

.ncert-format .choice-answers > div {
    background: #f0f8ff;
    padding: 12px;
    margin: 8px 0;
    border-left: 3px solid #3498db;
    border-radius: 4px;
}

/* Print Styles */
@media print {
    .ncert-format {
        padding: 15px;
    }
    
    .ncert-format .section-header {
        background: #667eea !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    
    .ncert-format .ncert-question {
        page-break-inside: avoid;
    }
    
    .ncert-format .case-study-question {
        page-break-inside: avoid;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .ncert-format {
        padding: 15px;
    }
    
    .ncert-format .paper-header h1 {
        font-size: 20px;
    }
    
    .ncert-format .section-header {
        font-size: 16px;
        padding: 10px 15px;
    }
    
    .ncert-format .question-text,
    .ncert-format .option {
        font-size: 14px;
    }
    
    .ncert-format .internal-choice {
        padding: 15px;
    }
}

/* Hindi Font Support */
.ncert-format[lang="hi"],
.ncert-format[lang="Hindi"] {
    font-family: 'Noto Sans Devanagari', 'Mangal', 'Arial Unicode MS', sans-serif;
}