/* MathMentor IA Custom Styles */

:root {
    /* Light mode colors */
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e9ecef;
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-heading: #2c3e50;
    --border-color: #dee2e6;
    --shadow: rgba(0, 0, 0, 0.1);
    --card-hover-shadow: rgba(0, 0, 0, 0.15);
    --code-bg: #f8f9fa;
    --feedback-bg: #f8f9fa;
    --feedback-success-bg: #d4edda;
    --feedback-error-bg: #f8d7da;
    --navbar-bg: #0d6efd;
    --tooltip-bg: #2c3e50;
}

body.dark-mode {
    /* Dark mode colors */
    --bg-primary: #1a1d23;
    --bg-secondary: #25292f;
    --bg-tertiary: #2f3439;
    --text-primary: #e9ecef;
    --text-secondary: #adb5bd;
    --text-heading: #f8f9fa;
    --border-color: #3d4349;
    --shadow: rgba(0, 0, 0, 0.3);
    --card-hover-shadow: rgba(0, 0, 0, 0.5);
    --code-bg: #1e2228;
    --feedback-bg: #2f3439;
    --feedback-success-bg: #1a3a2a;
    --feedback-error-bg: #3a1a1a;
    --navbar-bg: #0a58ca;
    --tooltip-bg: #495057;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.card {
    border: none;
    border-radius: 10px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    box-shadow: 0 2px 10px var(--shadow);
    transition: transform 0.2s, box-shadow 0.3s ease, background-color 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 4px 15px var(--card-hover-shadow);
}

.card-header {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.card-footer {
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    transition: background-color 0.3s ease;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.btn {
    border-radius: 5px;
}

/* Exercise area */
.exercise-container {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    padding: 30px;
    border-radius: 10px;
    box-shadow: 0 2px 10px var(--shadow);
    transition: background-color 0.3s ease, color 0.3s ease;
}

.feedback-box {
    background-color: var(--feedback-bg);
    color: var(--text-primary);
    padding: 20px;
    border-left: 4px solid #0d6efd;
    border-radius: 5px;
    margin-top: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.feedback-box.success {
    border-left-color: #28a745;
    background-color: var(--feedback-success-bg);
}

.feedback-box.error {
    border-left-color: #dc3545;
    background-color: var(--feedback-error-bg);
}

/* Score display */
.score-badge {
    font-size: 2rem;
    padding: 20px;
    border-radius: 50%;
    width: 100px;
    height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.streak-indicator {
    display: inline-block;
    padding: 5px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px;
    font-weight: bold;
}

/* Markdown content styling */
.markdown-content {
    line-height: 1.8;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    transition: color 0.3s ease;
}

.markdown-content h3 {
    font-size: 1.3rem;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.5rem;
    transition: border-color 0.3s ease;
}

.markdown-content p {
    margin-bottom: 1rem;
}

.markdown-content ul,
.markdown-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.markdown-content li {
    margin-bottom: 0.5rem;
}

.markdown-content strong {
    font-weight: 600;
    color: var(--text-heading);
    transition: color 0.3s ease;
}

.markdown-content code {
    background-color: var(--code-bg);
    color: var(--text-primary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.markdown-content pre {
    background-color: var(--code-bg);
    color: var(--text-primary);
    padding: 1rem;
    border-radius: 5px;
    overflow-x: auto;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-content hr {
    border: none;
    border-top: 2px solid var(--border-color);
    margin: 1.5rem 0;
    transition: border-color 0.3s ease;
}

.markdown-content blockquote {
    border-left: 4px solid #007bff;
    padding-left: 1rem;
    margin-left: 0;
    color: var(--text-secondary);
    font-style: italic;
    transition: color 0.3s ease;
}

/* Math (LaTeX) styling */
.markdown-content .MathJax {
    font-size: 1.1em;
}

/* Procedure selection styling */
.procedure-item {
    transition: background-color 0.2s;
    padding: 8px;
    border-radius: 5px;
}

.procedure-item:hover {
    background-color: var(--bg-tertiary);
}

.procedure-item label {
    cursor: pointer;
    user-select: none;
}

.procedure-item label i {
    font-size: 0.9em;
    margin-left: 5px;
}

/* Custom tooltip styling */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    max-width: 300px;
    text-align: left;
    padding: 10px 12px;
    background-color: var(--tooltip-bg);
    transition: background-color 0.3s ease;
}

.tooltip-arrow::before {
    border-right-color: var(--tooltip-bg) !important;
}

/* Dark Mode Toggle Switch */
.theme-switch-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.theme-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.theme-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.4s;
    border-radius: 26px;
}

.theme-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.4s;
    border-radius: 50%;
}

input:checked + .theme-slider {
    background-color: #0d6efd;
}

input:checked + .theme-slider:before {
    transform: translateX(24px);
}

.theme-icon {
    font-size: 1.2rem;
    color: rgba(255, 255, 255, 0.9);
}

/* Table dark mode support */
.table {
    color: var(--text-primary);
    transition: color 0.3s ease;
}

.dark-mode .table-light {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

.dark-mode .table-hover tbody tr:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Modal dark mode support */
.dark-mode .modal-content {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dark-mode .modal-header {
    border-bottom-color: var(--border-color);
}

.dark-mode .modal-footer {
    border-top-color: var(--border-color);
}

/* Form controls dark mode */
.dark-mode .form-control,
.dark-mode .form-select {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dark-mode .form-control:focus,
.dark-mode .form-select:focus {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: #0d6efd;
}

/* Placeholder text dark mode */
.dark-mode .form-control::placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.dark-mode .form-control::-webkit-input-placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.dark-mode .form-control::-moz-placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

.dark-mode .form-control:-ms-input-placeholder {
    color: var(--text-secondary);
    opacity: 0.7;
}

/* Text muted dark mode */
.dark-mode .text-muted {
    color: var(--text-secondary) !important;
}

/* Form labels dark mode */
.dark-mode .form-label,
.dark-mode label {
    color: var(--text-primary);
}

/* Form check (checkboxes and radios) dark mode */
.dark-mode .form-check-label {
    color: var(--text-primary);
}

.dark-mode .form-check-input {
    background-color: var(--bg-tertiary);
    border-color: var(--border-color);
}

.dark-mode .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* List group dark mode */
.dark-mode .list-group-item {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Alert dark mode */
.dark-mode .alert {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

/* Navbar dark mode - keep primary color but adjust for dark mode */
.dark-mode .navbar-dark {
    background-color: var(--navbar-bg) !important;
}

/* Dropdown menu dark mode */
.dark-mode .dropdown-menu {
    background-color: var(--bg-secondary);
    border-color: var(--border-color);
}

.dark-mode .dropdown-item {
    color: var(--text-primary);
}

.dark-mode .dropdown-item:hover {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Badge dark mode - ensure good contrast */
.dark-mode .badge {
    border: 1px solid var(--border-color);
}

/* Button text dark mode */
.dark-mode .btn-light {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
    border-color: var(--border-color);
}

.dark-mode .btn-light:hover {
    background-color: var(--bg-secondary);
    color: var(--text-primary);
}

/* Small text dark mode */
.dark-mode .small,
.dark-mode small {
    color: var(--text-secondary);
}

/* Strong/Bold text dark mode */
.dark-mode strong,
.dark-mode b {
    color: var(--text-primary);
}

/* Info icon color adjustment */
.dark-mode .bi-info-circle.text-muted {
    color: var(--text-secondary) !important;
    opacity: 0.8;
}

/* Headings dark mode */
.dark-mode h1,
.dark-mode h2,
.dark-mode h3,
.dark-mode h4,
.dark-mode h5,
.dark-mode h6 {
    color: var(--text-heading);
}

/* Paragraph text dark mode */
.dark-mode p {
    color: var(--text-primary);
}
