/* Assignment Manager CSS - Enhanced with inline labels */
.am-form {
    max-width: 1000px;
    margin: 2rem auto;
    padding: 2rem;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.am-form h2, .am-form h3, .am-form h4 {
    color: #2c3e50;
    margin-top: 0;
}

.am-form h2 {
    border-bottom: 3px solid #3498db;
    padding-bottom: 0.75rem;
    margin-bottom: 1.5rem;
}

.am-form h3 {
    border-bottom: 2px solid #eee;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
}

.form-section {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.form-row {
    margin-bottom: 1.25rem;
}

/* Inline label styles */
.form-row.inline-label {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: flex-start;
    margin-bottom: 1.25rem;
}

.form-row.inline-label .label-group {
    flex: 1;
    min-width: 250px;
}

.form-row.inline-label input,
.form-row.inline-label select,
.form-row.inline-label textarea {
    flex: 2;
    min-width: 300px;
}

.label-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
    font-size: 1rem;
}

.label-group .form-help {
    font-size: 0.9em;
    color: #666;
    margin-top: 0.25rem;
    font-style: italic;
}

.am-form input[type="text"],
.am-form input[type="email"],
.am-form textarea,
.am-form select {
    width: 100%;
    padding: 0.875rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: all 0.3s;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.am-form textarea {
    min-height: 150px;
    resize: vertical;
    line-height: 1.6;
}

.am-form input:focus,
.am-form textarea:focus,
.am-form select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.am-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin: 1rem 0;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.am-table th {
    background: #2c3e50;
    color: white;
    padding: 1rem;
    text-align: left;
    font-weight: 600;
}

.am-table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid #eee;
}

.am-table tr:last-child td {
    border-bottom: none;
}

.am-table tr:nth-child(even) {
    background: #f9f9f9;
}

.am-table tr:hover {
    background: #f0f7ff;
}

.am-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.am-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.am-warning {
    background: #fff3cd;
    border: 1px solid #ffeaa7;
    color: #856404;
    padding: 0.875rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.am-info {
    background: #d1ecf1;
    border: 1px solid #bee5eb;
    color: #0c5460;
    padding: 1rem;
    border-radius: 6px;
    margin: 1rem 0;
}

.ai-assessment-display {
    max-width: 1200px;
    margin: 2rem auto;
}

.submissions-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.submission-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.submission-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid #eee;
}

.submission-header h4 {
    margin: 0 0 0.5rem 0;
    color: #2c3e50;
    font-size: 1.25rem;
}

.submission-meta {
    color: #6c757d;
    font-size: 0.9em;
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.text-content pre {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: 6px;
    overflow-x: auto;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    white-space: pre-wrap;
    line-height: 1.5;
    border: 1px solid #e9ecef;
}

.assessment-result {
    margin-top: 1.5rem;
    padding: 1.25rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
}

.score-display {
    font-size: 1.3em;
    margin-bottom: 1rem;
    font-weight: 600;
}

.score-value {
    font-weight: bold;
    color: #ffeb3b;
}

.feedback-content {
    line-height: 1.7;
    background: rgba(255, 255, 255, 0.1);
    padding: 1rem;
    border-radius: 6px;
    margin-top: 1rem;
}

.admin-stats {
    background: #e3f2fd;
    padding: 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    border-left: 4px solid #2196f3;
}

.no-submissions {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

.button {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s;
    font-weight: 600;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.button:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.button-primary {
    background: linear-gradient(135deg, #2c3e50 0%, #4a6572 100%);
}

.button-danger {
    background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
}

.button-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.button:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Form validation styles */
input:invalid, textarea:invalid {
    border-color: #dc3545;
}

input:valid, textarea:valid {
    border-color: #28a745;
}

/* Loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-top: 3px solid #fff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

.spinner-dark {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid #3498db;
}

/* File upload area */
.file-upload-area {
    border: 2px dashed #3498db;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    background: #f8f9fa;
    transition: all 0.3s;
    margin: 1rem 0;
}

.file-upload-area:hover {
    background: #e3f2fd;
    border-color: #2980b9;
}

.file-upload-area.dragover {
    background: #d4edda;
    border-color: #28a745;
}

/* Progress bar */
.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.3s;
    border-radius: 4px;
}

/* Notification styles */
.am-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 1.25rem 1.5rem;
    border-radius: 8px;
    color: white;
    font-weight: 500;
    z-index: 10000;
    max-width: 400px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
    animation: slideInRight 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(10px);
}

.am-notification-success {
    background: rgba(40, 167, 69, 0.95);
    border-left: 5px solid #28a745;
}

.am-notification-error {
    background: rgba(220, 53, 69, 0.95);
    border-left: 5px solid #dc3545;
}

.am-notification-info {
    background: rgba(23, 162, 184, 0.95);
    border-left: 5px solid #17a2b8;
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Responsive styles */
@media (max-width: 768px) {
    .am-form {
        padding: 1rem;
        margin: 1rem;
    }
    
    .form-section {
        padding: 1rem;
    }
    
    .form-row.inline-label {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-row.inline-label .label-group,
    .form-row.inline-label input,
    .form-row.inline-label select {
        width: 100%;
        min-width: auto;
    }
    
    .am-table {
        display: block;
        overflow-x: auto;
        font-size: 0.9rem;
    }
    
    .am-table th,
    .am-table td {
        padding: 0.75rem 0.5rem;
    }
    
    .submission-item {
        padding: 1rem;
    }
    
    .button {
        padding: 0.75rem 1.25rem;
        font-size: 0.9rem;
        width: 100%;
        margin-bottom: 0.5rem;
    }
    
    .am-notification {
        left: 10px;
        right: 10px;
        max-width: none;
    }
}

/* Print styles */
@media print {
    .am-form,
    .ai-assessment-display {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .button,
    .am-notification {
        display: none;
    }
}

/* Critical layout fixes */
.test-layout {
    display: flex !important;
    gap: 30px;
    margin-top: 20px;
    min-height: 700px;
    width: 100%;
}

.test-left-column {
    flex: var(--left-ratio, 2) !important;
    max-width: calc((var(--left-ratio, 2) / (var(--left-ratio, 2) + var(--right-ratio, 1))) * 100%) !important;
    overflow-y: auto;
    max-height: 800px;
    padding-right: 15px;
    transition: flex 0.3s ease;
}

.test-right-column {
    flex: var(--right-ratio, 1) !important;
    max-width: calc((var(--right-ratio, 1) / (var(--left-ratio, 2) + var(--right-ratio, 1))) * 100%) !important;
    overflow-y: auto;
    max-height: 800px;
    transition: flex 0.3s ease;
}

/* Ensure material boxes don't break layout */
.material-section {
    margin-bottom: 20px;
    width: 100%;
}

.material-box {
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    width: 100%;
}

.material-content {
    padding: 20px;
    max-height: 500px;
    overflow-y: auto;
    background: #fafafa;
    width: 100%;
    box-sizing: border-box;
}

/* Answer form container */
.answer-form-container {
    padding: 0 10px;
    width: 100%;
    box-sizing: border-box;
}

.am-form {
    width: 100%;
    box-sizing: border-box;
}

/* Layout saved indicator */
.layout-saved-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #28a745;
    color: white;
    font-size: 12px;
    line-height: 16px;
    text-align: center;
    margin-left: 5px;
    opacity: 0;
    transition: opacity 0.3s;
}

.layout-saved-indicator.visible {
    opacity: 1;
}

/* Layout controls */
.layout-controls {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}

.layout-slider-container {
    flex: 1;
    min-width: 300px;
}

.layout-slider-container label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #495057;
}

#column-ratio {
    width: 100%;
    margin: 5px 0;
}

.slider-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #6c757d;
    margin-top: 5px;
}

#reset-layout {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

#reset-layout:hover {
    background: #5a6268;
}

/* Responsive fallback */
@media (max-width: 768px) {
    .test-layout {
        flex-direction: column !important;
    }
    
    .test-left-column,
    .test-right-column {
        max-width: 100% !important;
        flex: none !important;
        max-height: none;
        padding-right: 0;
    }
}

/* ===== FEEDBACK FORMATTER OVERRIDES - ADD AT THE VERY END ===== */
/* THESE STYLES ONLY APPLY TO PAGES WITH am-formatter-container */
.am-formatter-container {
    max-width: 1600px !important;
    margin: 40px auto !important;
    padding: 30px !important;
    background: white !important;
    border-radius: 15px !important;
    box-shadow: 0 5px 20px rgba(0,0,0,0.1) !important;
    box-sizing: border-box !important;
}

.am-formatter-container .am-formatter-header {
    text-align: center !important;
    margin-bottom: 40px !important;
}

.am-formatter-container .am-formatter-header h1 {
    font-size: 2.5rem !important;
    margin-bottom: 10px !important;
    color: #2c3e50 !important;
}

.am-formatter-container .am-formatter-subtitle {
    font-size: 1.2rem !important;
    color: #666 !important;
}

.am-formatter-container .am-formatter-layout {
    display: flex !important;
    flex-direction: row !important;
    gap: 30px !important;
    width: 100% !important;
    min-height: 600px !important;
    aspect-ratio: 16/9 !important;
}

.am-formatter-container .am-formatter-input-section {
    flex: 7 !important;
    height: 100% !important;
    overflow-y: auto !important;
    background: #f8f9fa !important;
    padding: 25px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
}

.am-formatter-container .am-formatter-output-section {
    flex: 9 !important;
    height: 100% !important;
    overflow-y: auto !important;
    background: #f8f9fa !important;
    padding: 25px !important;
    border-radius: 12px !important;
    box-sizing: border-box !important;
}

.am-formatter-container .am-formatter-input-section h2,
.am-formatter-container .am-formatter-output-section h2 {
    margin-top: 0 !important;
    margin-bottom: 20px !important;
    color: #2c3e50 !important;
    font-size: 1.5rem !important;
}

.am-formatter-container .am-raw-textarea {
    width: 100% !important;
    height: 400px !important;
    padding: 15px !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    font-family: monospace !important;
    font-size: 14px !important;
    line-height: 1.6 !important;
    resize: vertical !important;
    box-sizing: border-box !important;
}

.am-formatter-container .am-raw-textarea:focus {
    border-color: #667eea !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(102,126,234,0.1) !important;
}

.am-formatter-container .am-formatter-actions {
    display: flex !important;
    gap: 15px !important;
    margin: 20px 0 !important;
    flex-wrap: wrap !important;
}

.am-formatter-container .am-button {
    padding: 10px 20px !important;
    border: none !important;
    border-radius: 6px !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.3s !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 5px !important;
}

.am-formatter-container .am-button-primary {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
}

.am-formatter-container .am-button-secondary {
    background: #6c757d !important;
    color: white !important;
}

.am-formatter-container .am-button-small {
    padding: 8px 15px !important;
    font-size: 13px !important;
}

.am-formatter-container .am-button:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2) !important;
}

.am-formatter-container .am-sample-section {
    margin-top: 20px !important;
    padding-top: 20px !important;
    border-top: 1px solid #e0e0e0 !important;
}

.am-formatter-container .am-sample-section h3 {
    margin: 0 0 15px 0 !important;
    color: #495057 !important;
    font-size: 1.2rem !important;
}

.am-formatter-container .am-sample-buttons {
    display: flex !important;
    gap: 10px !important;
    flex-wrap: wrap !important;
}

.am-formatter-container .am-formatted-output {
    min-height: 400px !important;
    max-height: 500px !important;
    overflow-y: auto !important;
    background: white !important;
    border: 2px solid #e0e0e0 !important;
    border-radius: 8px !important;
    padding: 20px !important;
    margin-bottom: 25px !important;
    line-height: 1.6 !important;
}

.am-formatter-container .am-placeholder {
    color: #999 !important;
    text-align: center !important;
    padding: 50px !important;
    font-style: italic !important;
}

.am-formatter-container .am-enhancement-tools {
    margin-top: 30px !important;
}

.am-formatter-container .am-enhancement-tools h3 {
    margin: 0 0 15px 0 !important;
    color: #2c3e50 !important;
}

.am-formatter-container .am-download-section {
    display: flex !important;
    gap: 15px !important;
    margin: 20px 0 !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
}

.am-formatter-container .am-captured-alert {
    background: #d4edda !important;
    border-left: 4px solid #28a745 !important;
    padding: 15px 20px !important;
    border-radius: 8px !important;
    margin-bottom: 30px !important;
}

/* Score box styling for formatter */
.am-formatter-container .am-score-box {
    background: linear-gradient(135deg, #667eea, #764ba2) !important;
    color: white !important;
    padding: 20px !important;
    border-radius: 10px !important;
    text-align: center !important;
    margin-bottom: 30px !important;
}

.am-formatter-container .am-score {
    font-size: 48px !important;
    font-weight: bold !important;
}

.am-formatter-container .am-score-label {
    font-size: 1.1rem !important;
    opacity: 0.9 !important;
}

/* Responsive for formatter */
@media (max-width: 768px) {
    .am-formatter-container .am-formatter-layout {
        flex-direction: column !important;
        aspect-ratio: auto !important;
        min-height: auto !important;
    }
    
    .am-formatter-container .am-formatter-input-section,
    .am-formatter-container .am-formatter-output-section {
        width: 100% !important;
        flex: none !important;
    }
    
    .am-formatter-container .am-raw-textarea {
        height: 200px !important;
    }
}


