@import url('https://fonts.googleapis.com/css2?family=Assistant:wght@300;400;500;600;700&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Assistant', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

:root {
    --primary: #8AA899;
    --primary-dark: #5C6E58;
    --secondary: #F2D349;
    --success: #8AA899;
    --warning: #F2D349;
    --light: #f8f9fa;
    --dark: #424242;
    --gray: #757575;
    --light-gray: #e9ecef;
    --border-radius: 12px;
    --box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    --transition: all 0.3s ease;
}

/* Gold Theme */
body[data-theme="gold"] {
    --primary: #D4AF37;
    --primary-dark: #B8941F;
    --secondary: #8B7355;
    --success: #D4AF37;
    --warning: #FFD700;
    --light: #FFF9E6;
    --dark: #3E3021;
    --gray: #8B7355;
    --light-gray: #F5E6D3;
}

/* Rose Theme */
body[data-theme="rose"] {
    --primary: #C97C7C;
    --primary-dark: #A85F5F;
    --secondary: #E6A8A8;
    --success: #C97C7C;
    --warning: #E6A8A8;
    --light: #FFF5F5;
    --dark: #4A2828;
    --gray: #A87676;
    --light-gray: #F5E3E3;
}

/* Blue Theme */
body[data-theme="blue"] {
    --primary: #5B9BD5;
    --primary-dark: #4178B3;
    --secondary: #7CB8E8;
    --success: #5B9BD5;
    --warning: #FFC000;
    --light: #F0F7FF;
    --dark: #1F3A5F;
    --gray: #6B7A8F;
    --light-gray: #E3F0FF;
}

/* Navy Blue Theme */
body[data-theme="navy"] {
    --primary: #1E3A8A;
    --primary-dark: #1E40AF;
    --secondary: #3B82F6;
    --success: #2563EB;
    --warning: #F59E0B;
    --light: #EFF6FF;
    --dark: #0F172A;
    --gray: #475569;
    --light-gray: #CBD5E1;
}

body {
    background-color: var(--light);
    color: var(--dark);
    line-height: 1.6;
    min-height: 100vh;
}

/* סגנונות כללים */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

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

.btn-primary {
    background-color: var(--primary);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(67, 97, 238, 0.2);
}

.btn-secondary {
    background-color: var(--light);
    color: var(--dark);
    border: 1px solid #dee2e6;
}

.btn-secondary:hover {
    background-color: #e9ecef;
}

.btn-success {
    background-color: var(--success);
    color: white;
}

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

.btn-danger:hover:not(:disabled) {
    background: #ff5252;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(255, 107, 107, 0.3);
}

/* Ensure delete buttons are square/circular */
.btn-danger.delete-btn,
button.btn-danger.delete-btn {
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 50% !important;
}

.btn-warning {
    background-color: var(--warning);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background-color: #e6c200;
    opacity: 0.9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(242, 211, 73, 0.3);
}

.btn-info {
    background-color: #3b82f6;
    color: white;
}

.btn-info:hover:not(:disabled) {
    background-color: #2563eb;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(59, 130, 246, 0.3);
}

.card {
    background: white;
    border-radius: var(--border-radius);
    padding: 24px;
    box-shadow: var(--box-shadow);
    transition: var(--transition);
    height: 100%;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* עיצוב כותרת */
.header {
    background: linear-gradient(135deg, var(--secondary) 0%, var(--primary) 100%);
    color: white;
    padding: 20px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
}

.logo-text h1 {
    font-size: 24px;
    margin-bottom: 4px;
}

.logo-text p {
    font-size: 14px;
    opacity: 0.9;
}

.user-section {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

/* עיצוב ניווט */
.nav-tabs {
    display: flex;
    gap: 8px;
    margin: 20px 0;
    flex-wrap: wrap;
}

.tab {
    padding: 14px 24px;
    background: white;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    font-size: 16px;
    color: var(--dark);
    transition: var(--transition);
    border: 2px solid transparent;
}

.tab:hover {
    background-color: var(--light-gray);
    color: var(--primary);
}

.tab.active {
    background-color: var(--primary);
    color: white;
}

.tab-content {
    display: none;
}

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

/* עיצוב דשבורד */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 30px;
}

.stat-card {
    text-align: center;
    padding: 30px 20px;
}

.stat-icon {
    font-size: 48px;
    margin-bottom: 16px;
    color: var(--primary);
}

.stat-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--gray);
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.action-card {
    text-align: center;
    padding: 30px 20px;
    cursor: pointer;
}

/* עיצוב יצירת מבחן */
.exam-form {
    max-width: 800px;
}

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

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--dark);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #dee2e6;
    border-radius: var(--border-radius);
    font-size: 16px;
    transition: var(--transition);
}

/* תיבת חיפוש דינמית */
#student-search {
    transition: all 0.3s ease;
    border: 2px solid #e0e0e0;
    background: #fff;
}

#student-search:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(138, 168, 153, 0.15);
    background: #fff;
}

#student-search::placeholder {
    color: var(--gray);
    opacity: 0.6;
}

.question-container {
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 24px;
    background-color: #fafafa;
}

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

.rubric-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.rubric-item input {
    flex: 1;
}

.rubric-points {
    width: 80px;
}

.delete-btn {
    background: #ff6b6b;
    color: white;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    flex-shrink: 0;
}

.delete-btn:hover {
    background: #ff5252;
}

/* עיצוב רשימת מבחנים */
.exams-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.exam-card {
    position: relative;
    overflow: hidden;
}

.btn-delete-exam {
    position: absolute;
    top: 8px;
    left: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    z-index: 10;
}

.btn-delete-exam:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
    transform: scale(1.1);
}

.btn-delete-exam i {
    color: #ef4444;
    font-size: 12px;
}

.exam-status {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    color: white;
}

.status-active {
    background-color: var(--success);
}

.status-pending {
    background-color: var(--warning);
}

.status-completed {
    background-color: var(--gray);
}

.exam-subject {
    font-size: 14px;
    color: var(--primary);
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.exam-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--dark);
}

.exam-meta {
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
    color: var(--gray);
    font-size: 14px;
}

.exam-actions {
    display: flex;
    gap: 12px;
}

/* עיצוב בדיקת מבחנים */
.grading-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

.upload-area {
    border: 2px dashed #dee2e6;
    border-radius: var(--border-radius);
    padding: 40px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-bottom: 24px;
}

.upload-area:hover {
    border-color: var(--primary);
    background-color: rgba(67, 97, 238, 0.02);
}

.upload-icon {
    font-size: 48px;
    color: var(--primary);
    margin-bottom: 16px;
}

.students-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.students-table th {
    padding: 12px;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
}

.students-table td {
    padding: 12px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.students-table .btn {
    min-width: 40px;
    padding: 8px 12px;
    font-size: 14px;
}

.students-table .btn i {
    margin: 0;
}

.progress-bar {
    height: 8px;
    background: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    transition: width 0.3s ease;
}

/* עיצוב תוצאות */
.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.grade-distribution {
    margin: 30px 0;
}

.grade-bar {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.grade-label {
    width: 80px;
    font-weight: 600;
}

.grade-visual {
    flex: 1;
    height: 24px;
    background-color: #e9ecef;
    border-radius: 12px;
    overflow: hidden;
    margin: 0 12px;
}

.grade-fill {
    height: 100%;
    background-color: var(--primary);
}

.grade-count {
    width: 60px;
    text-align: left;
}

/* עיצוב רספונסיבי */
@media (max-width: 992px) {
    .grading-container {
        grid-template-columns: 1fr;
    }
    
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 20px;
        text-align: center;
    }
    
    .nav-tabs {
        flex-wrap: wrap;
    }
    
    .tab {
        flex: 1 0 50%;
        padding: 14px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .quick-actions {
        grid-template-columns: 1fr;
    }
    
    .exams-list {
        grid-template-columns: 1fr;
    }
    
    .exam-actions {
        flex-direction: column;
    }
}

/* אנימציות */
.pulse {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* טעינה */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(67, 97, 238, 0.3);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

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

/* הודעות */
.alert {
    padding: 16px;
    border-radius: var(--border-radius);
    margin-bottom: 20px;
}

.alert-success {
    background-color: rgba(76, 201, 240, 0.1);
    border-left: 4px solid var(--success);
    color: #0a7c8c;
}

.alert-warning {
    background-color: rgba(247, 37, 133, 0.1);
    border-left: 4px solid var(--warning);
    color: #b5174e;
}

.alert-info {
    background-color: rgba(67, 97, 238, 0.1);
    border-left: 4px solid var(--primary);
    color: #3a56d4;
}

.alert-danger {
    background-color: rgba(255, 107, 107, 0.1);
    border-left: 4px solid #ff6b6b;
    color: #d63031;
}

/* ריקים */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    font-size: 64px;
    margin-bottom: 20px;
    color: #dee2e6;
}

/* Login/Register Styles */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E3A8A 0%, #1E40AF 100%);
    padding: 20px;
}

.auth-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 100%;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.auth-header {
    text-align: center;
    margin-bottom: 30px;
    width: 100%;
}

.auth-header h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--dark);
}

.auth-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* Modal styles */
#student-report-modal {
    animation: fadeIn 0.3s ease;
}

#student-report-modal > div {
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Print styles for report */
@media print {
    /* הסתר את כל העמוד */
    body > *:not(#student-report-modal) {
        display: none !important;
    }
    
    /* הסתר כפתורים במודאל */
    .btn, .header, .nav-tabs {
        display: none !important;
    }

    /* הצג רק את המודאל */
    #student-report-modal {
        background: white !important;
        position: relative !important;
        display: block !important;
        padding: 0 !important;
        overflow: visible !important;
    }

    #student-report-modal > div {
        max-height: none !important;
        max-width: none !important;
        box-shadow: none !important;
        overflow: visible !important;
        page-break-inside: avoid;
    }
    
    /* שמור על העיצוב של המודאל בהדפסה */
    #student-report-modal h2,
    #student-report-modal h3,
    #student-report-modal strong {
        color: #000 !important;
    }
    
    /* וודא שהצבעים נדפסים */
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
}

/* Exam Edit Modal Styles */
.rubric-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px;
    background: white;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.rubric-item textarea {
    resize: vertical;
    font-size: 14px;
    line-height: 1.5;
}

.delete-btn {
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    width: 36px !important;
    height: 36px !important;
    min-width: 36px !important;
    min-height: 36px !important;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    font-size: 16px;
    flex-shrink: 0;
}

.delete-btn:hover {
    background: #cc0000;
    transform: scale(1.1);
}

.question-container {
    transition: var(--transition);
}

.question-container:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.score-feedback-group {
    display: flex;
    gap: 20px;
    align-items: flex-start;
}

.score-input-wrapper {
    flex: 0 0 150px;
}

.feedback-input-wrapper {
    flex: 1;
}

/* Theme Dots (Color Switcher) */
.theme-dots {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    align-items: center;
}

.theme-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: inline-block;
}

.theme-dot:hover {
    transform: scale(1.3);
    border-color: rgba(255, 255, 255, 0.8);
}

.theme-dot.active {
    border-color: white;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
    transform: scale(1.2);
}

/* Users List Table */
.users-table {
    width: 100%;
    border-collapse: collapse;
}

.users-table thead {
    background: var(--light-gray);
}

.users-table th {
    padding: 15px;
    text-align: right;
    font-weight: 600;
    color: var(--dark);
    border-bottom: 2px solid var(--primary);
}

.users-table td {
    padding: 15px;
    border-bottom: 1px solid var(--light-gray);
}

.users-table tr:hover {
    background: var(--light);
}

.admin-badge {
    background: var(--warning);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    border-right: 4px solid var(--primary);
    animation: slideInRight 0.3s ease-out, fadeOut 0.3s ease-out 4.7s;
    transition: var(--transition);
}

.toast:hover {
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    transform: translateX(-4px);
}

.toast.success {
    border-right-color: var(--success);
}

.toast.success .toast-icon {
    color: var(--success);
}

.toast.error {
    border-right-color: #e74c3c;
}

.toast.error .toast-icon {
    color: #e74c3c;
}

.toast.warning {
    border-right-color: var(--warning);
}

.toast.warning .toast-icon {
    color: var(--warning);
}

.toast.info {
    border-right-color: var(--primary);
}

.toast.info .toast-icon {
    color: var(--primary);
}

.toast-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    color: var(--dark);
    margin-bottom: 4px;
    font-size: 15px;
}

.toast-message {
    color: var(--gray);
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-line;
}

.toast-close {
    background: none;
    border: none;
    color: var(--gray);
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: var(--transition);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--light-gray);
    color: var(--dark);
}

@keyframes slideInRight {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

/* Confirm Modal */
.confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    animation: fadeIn 0.2s ease-out;
}

.confirm-modal {
    background: white;
    border-radius: 12px;
    padding: 30px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease-out;
}

.confirm-icon {
    font-size: 48px;
    margin-bottom: 20px;
    text-align: center;
}

.confirm-icon.warning {
    color: var(--warning);
}

.confirm-icon.danger {
    color: #e74c3c;
}

.confirm-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--dark);
    margin-bottom: 15px;
    text-align: center;
}

.confirm-message {
    font-size: 16px;
    color: var(--gray);
    margin-bottom: 25px;
    text-align: center;
    line-height: 1.6;
    white-space: pre-line;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-buttons button {
    padding: 12px 30px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.confirm-btn-yes {
    background: var(--primary);
    color: white;
}

.confirm-btn-yes:hover {
    background: #3a8f7a;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 201, 240, 0.3);
}

.confirm-btn-no {
    background: #e0e0e0;
    color: var(--dark);
}

.confirm-btn-no:hover {
    background: #d0d0d0;
    transform: translateY(-2px);
}

.confirm-btn-danger {
    background: #e74c3c;
    color: white;
}

.confirm-btn-danger:hover {
    background: #c0392b;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

@keyframes scaleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* API Dashboard Links Styling */
.api-dashboard-link {
    transition: all 0.3s ease;
    transform: translateY(0);
}

.api-dashboard-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2) !important;
    opacity: 0.95;
}

.api-dashboard-link:active {
    transform: translateY(-2px);
}

