/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --amber: #ffbe0bff;
    --orange-pantone: #fb5607ff;
    --rose: #ff006eff;
    --blue-violet: #8338ecff;
    --azure: #3a86ffff;
    --amber-solid: #ffbe0b;
    --orange-pantone-solid: #fb5607;
    --rose-solid: #ff006e;
    --blue-violet-solid: #8338ec;
    --azure-solid: #3a86ff;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

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

/* Login Container */
.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--blue-violet-solid) 0%, var(--azure-solid) 100%);
}

.login-form {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    width: 100%;
    max-width: 400px;
}

.login-form h1 {
    text-align: center;
    margin-bottom: 10px;
    color: #333;
    font-size: 2rem;
}

.login-form p {
    text-align: center;
    margin-bottom: 30px;
    color: #666;
}

.error-message {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 8px;
    margin-top: 15px;
    text-align: center;
    border: 1px solid #f5c6cb;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 40px;
    padding: 30px 0;
    background: linear-gradient(135deg, var(--blue-violet-solid) 0%, var(--azure-solid) 100%);
    color: white;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    position: relative;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    font-weight: 600;
}

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

.logout-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    padding: 8px 16px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Form Section */
.form-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    font-family: inherit;
}

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

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--blue-violet-solid);
    box-shadow: 0 0 0 3px rgba(131, 56, 236, 0.1);
}

/* Grade Buttons */
.grade-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.grade-btn {
    padding: 10px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 45px;
}

.grade-btn:hover {
    border-color: var(--blue-violet-solid);
    background: #f0edff;
}

.grade-btn.active {
    background: var(--blue-violet-solid);
    color: white;
    border-color: var(--blue-violet-solid);
}

.grade-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(131, 56, 236, 0.3);
}

/* Subject Buttons */
.subject-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.subject-btn {
    padding: 10px 16px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    background: white;
    color: #555;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
}

.subject-btn:hover {
    border-color: var(--blue-violet-solid);
    background: #f0edff;
}

.subject-btn.active {
    background: var(--blue-violet-solid);
    color: white;
    border-color: var(--blue-violet-solid);
}

.subject-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(131, 56, 236, 0.3);
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-outline {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    margin-right: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--blue-violet-solid) 0%, var(--azure-solid) 100%);
    color: white;
    width: 100%;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--azure-solid) 0%, var(--blue-violet-solid) 100%);
    transform: translateY(-2px);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--blue-violet-solid) 0%, var(--azure-solid) 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, var(--azure-solid) 0%, var(--blue-violet-solid) 100%);
    transform: translateY(-2px);
}

.btn-outline {
    background: transparent;
    color: var(--blue-violet-solid);
    border: 2px solid var(--blue-violet-solid);
}

.btn-outline:hover {
    background: var(--blue-violet-solid);
    color: white;
    transform: translateY(-2px);
}

/* Loading Section */
.loading-section {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--blue-violet-solid);
    border-radius: 50%;
    width: 50px;
    height: 50px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

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

/* Result Section */
.result-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.result-section h2 {
    color: #333;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e5e9;
}

.lesson-info {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 25px;
}

.info-item {
    background: #f8f9fa;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--blue-violet-solid);
    border: 1px solid #e1e5e9;
}

.lesson-content {
    background: #f8f9fa;
    padding: 25px;
    border-radius: 8px;
    border-left: 4px solid var(--blue-violet-solid);
    margin-bottom: 25px;
    line-height: 1.8;
    font-size: 15px;
}

/* Markdown specific styles */
.lesson-content h1,
.lesson-content h2,
.lesson-content h3,
.lesson-content h4,
.lesson-content h5,
.lesson-content h6 {
    color: #333;
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
}

.lesson-content h1:first-child,
.lesson-content h2:first-child,
.lesson-content h3:first-child {
    margin-top: 0;
}

.lesson-content h1 {
    font-size: 1.8rem;
    border-bottom: 2px solid #e1e5e9;
    padding-bottom: 8px;
}

.lesson-content h2 {
    font-size: 1.5rem;
    color: var(--blue-violet-solid);
}

.lesson-content h3 {
    font-size: 1.3rem;
    color: #555;
}

.lesson-content h4 {
    font-size: 1.1rem;
}

.lesson-content p {
    margin-bottom: 16px;
}

.lesson-content ul,
.lesson-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.lesson-content li {
    margin-bottom: 8px;
}

.lesson-content li:last-child {
    margin-bottom: 0;
}

.lesson-content strong {
    font-weight: 600;
    color: #333;
}

.lesson-content em {
    font-style: italic;
    color: #555;
}

.lesson-content code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    color: var(--blue-violet-solid);
}

.lesson-content pre {
    background: #f1f3f4;
    padding: 16px;
    border-radius: 6px;
    border-left: 4px solid var(--blue-violet-solid);
    margin-bottom: 16px;
    overflow-x: auto;
}

.lesson-content pre code {
    background: none;
    padding: 0;
    color: inherit;
}

.lesson-content blockquote {
    border-left: 4px solid var(--blue-violet-solid);
    padding-left: 16px;
    margin: 16px 0;
    color: #666;
    font-style: italic;
    background: #f0edff;
    padding: 12px 16px;
    border-radius: 0 6px 6px 0;
}

.lesson-content table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
    background: white;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.lesson-content th,
.lesson-content td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid #e1e5e9;
}

.lesson-content th {
    background: var(--blue-violet-solid);
    color: white;
    font-weight: 600;
}

.lesson-content tr:last-child td {
    border-bottom: none;
}

.lesson-content hr {
    border: none;
    height: 2px;
    background: linear-gradient(90deg, var(--blue-violet-solid), transparent);
    margin: 24px 0;
}

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

/* History Section */
.history-section {
    background: white;
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.history-section h2 {
    margin-bottom: 20px;
    color: #333;
    padding-bottom: 10px;
    border-bottom: 2px solid #e1e5e9;
}

.history-list {
    display: grid;
    gap: 15px;
}

.history-item {
    background: #f8f9fa;
    padding: 15px 20px;
    border-radius: 8px;
    border-left: 4px solid var(--blue-violet-solid);
    transition: all 0.3s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.history-item-content {
    flex: 1;
    cursor: pointer;
}

.history-item-actions {
    margin-left: 15px;
    display: flex;
    gap: 8px;
}

.history-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.history-item-title {
    font-weight: 600;
    color: #333;
}

.history-item-details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
}

.history-item-details {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}

.history-detail {
    font-size: 14px;
    color: var(--blue-violet-solid);
    background: white;
    padding: 4px 12px;
    border-radius: 12px;
}

.history-detail.slides-available {
    color: var(--azure-solid);
    font-weight: 600;
}

/* Re-run button */
.btn-rerun {
    background: var(--blue-violet-solid);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.btn-rerun:hover {
    background: var(--azure-solid);
    transform: translateY(-1px);
}

.btn-rerun:active {
    transform: translateY(0);
}

/* Delete button */
.btn-delete {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.btn-delete:hover {
    background: #c82333;
    transform: translateY(-1px);
}

.btn-delete:active {
    transform: translateY(0);
}

/* Slides button */
.btn-slides {
    background: var(--azure-solid);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.btn-slides:hover {
    background: var(--blue-violet-solid);
    transform: translateY(-1px);
}

.btn-slides:active {
    transform: translateY(0);
}

/* PDF button */
.btn-pdf {
    background: var(--rose-solid);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
}

.btn-pdf:hover {
    background: var(--orange-pantone-solid);
    transform: translateY(-1px);
}

.btn-pdf:active {
    transform: translateY(0);
}

/* Loading button */
.btn-loading {
    background: var(--blue-violet-solid);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 14px;
    cursor: not-allowed;
    transition: all 0.3s ease;
    font-weight: 500;
    white-space: nowrap;
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Modal actions */
.modal-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

/* Modal */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 80%;
    max-height: 80%;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #999;
}

.close:hover {
    color: #333;
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 8px;
    }
    
    .login-form {
        padding: 20px 16px;
        margin: 12px;
    }
    
    .login-form h1 {
        font-size: 1.8rem;
    }
    
    .logout-btn {
        position: static;
        margin-top: 10px;
        width: auto;
        align-self: center;
    }
    
    header {
        display: flex;
        flex-direction: column;
        align-items: center;
        margin-bottom: 24px;
        padding: 20px 0;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .form-section,
    .result-section,
    .history-section {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .lesson-info {
        flex-direction: column;
    }
    
    .lesson-actions {
        flex-direction: column;
    }
    
    .btn-primary, .btn-secondary, .btn-outline {
        width: 100%;
        margin-right: 0;
        margin-bottom: 10px;
    }
    
    .history-item {
        flex-direction: column;
        align-items: stretch;
    }
    
    .history-item-details-row {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .history-item-actions {
        margin-left: 0;
        margin-top: 0;
        justify-content: flex-start;
    }
    
    .history-item-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }
    
    /* Grade buttons responsive */
    .grade-buttons {
        justify-content: center;
    }
    
    .grade-btn {
        flex: 1;
        min-width: 40px;
    }
    
    /* Subject buttons responsive */
    .subject-buttons {
        justify-content: center;
    }
    
    .subject-btn {
        flex: 1;
        min-width: 80px;
    }

    /* Modal responsive */
    .modal {
        align-items: flex-end;
    }
    
    .modal-content {
        width: 100%;
        max-width: 100%;
        max-height: 88%;
        margin: 0;
        padding: 20px 16px 16px;
        border-radius: 20px 20px 0 0;
        transform: translateY(0);
        animation: slideUp 0.3s ease-out;
    }
    
    @keyframes slideUp {
        from {
            transform: translateY(100%);
        }
        to {
            transform: translateY(0);
        }
    }
    
    .close {
        right: 20px;
        top: 15px;
        font-size: 24px;
        background: #f0f0f0;
        width: 32px;
        height: 32px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }
    
    .close:hover {
        background: #e0e0e0;
    }
    
    /* Reduce spacing for better mobile content density */
    .form-group {
        margin-bottom: 16px;
    }
    
    .lesson-content {
        padding: 16px;
        margin-bottom: 16px;
    }
    
    .lesson-info {
        gap: 8px;
        margin-bottom: 16px;
    }
    
    .history-item {
        padding: 12px 16px;
    }
    
    .btn-primary, .btn-secondary, .btn-outline {
        padding: 10px 20px;
        margin-bottom: 8px;
    }
}

/* Utility Classes */
.text-center {
    text-align: center;
}

.mt-20 {
    margin-top: 20px;
}

.mb-20 {
    margin-bottom: 20px;
} 