/* Enhanced Concept Card Styles */

/* Concept Learning Content Styles */
.learning-content {
    color: #374151;
    line-height: 1.7;
}

.learning-content h1 {
    font-size: 2.25rem;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: #111827;
    border-bottom: 2px solid #4A9B8E;
    padding-bottom: 0.5rem;
}

.learning-content h2 {
    font-size: 1.875rem;
    font-weight: 600;
    margin-top: 1.75rem;
    margin-bottom: 0.875rem;
    color: #1f2937;
}

.learning-content h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: #374151;
}

.learning-content h4 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: 1.25rem;
    margin-bottom: 0.625rem;
    color: #4b5563;
}

.learning-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.learning-content ul,
.learning-content ol {
    margin: 1rem 0;
    padding-left: 2rem;
}

.learning-content li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
    text-align: justify;
}

/* Ensure list items have proper bullet points */
.learning-content ul li {
    list-style-type: disc;
    list-style-position: outside;
}

.learning-content ul li::marker {
    color: #4A9B8E;
    font-size: 1.1em;
}

/* Ensure ordered list items have proper numbers */
.learning-content ol li {
    list-style-type: decimal;
    list-style-position: outside;
}

.learning-content ol li::marker {
    color: inherit;
    font-weight: 600;
}

/* For nested lists */
.learning-content ul ul {
    margin-top: 0.5rem;
    margin-bottom: 0.5rem;
}

.learning-content ul ul li {
    list-style-type: circle;
}

.learning-content ul ul ul li {
    list-style-type: square;
}

.learning-content blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid #4A9B8E;
    background: linear-gradient(to right, #f0fdfa, #ffffff);
    font-style: italic;
    color: #065f46;
}

.learning-content code {
    background: #f3f4f6;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875em;
    color: #be123c;
}

.learning-content pre {
    background: #1f2937;
    color: #f9fafb;
    padding: 1.5rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.learning-content pre code {
    background: transparent;
    color: inherit;
    padding: 0;
    font-size: 0.875rem;
    line-height: 1.5;
}


/* Responsive Table Container */
.learning-content .table-wrapper {
    overflow-x: auto;
    margin: 1.5rem 0;
    border-radius: 0.5rem;
    box-shadow: inset 0 0 0 1px #e5e7eb;
}

/* Enhanced Blockquotes */
.learning-content blockquote {
    border-left: 4px solid #4A9B8E;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
    background: linear-gradient(to right, #f0fdfa, white);
    color: #374151;
    font-style: italic;
    border-radius: 0 0.5rem 0.5rem 0;
}

.learning-content blockquote blockquote {
    border-left-color: #10b981;
    background: linear-gradient(to right, #ecfdf5, white);
}

.learning-content blockquote blockquote blockquote {
    border-left-color: #059669;
    background: linear-gradient(to right, #d1fae5, white);
}


/* Fallback Content Styles */
.fallback-content {
    color: #374151;
    line-height: 1.6;
}

.fallback-content strong {
    font-weight: 700;
    color: #111827;
}

.fallback-content em {
    font-style: italic;
    color: #4b5563;
}

/* Loading Content Styles */
.loading-content {
    padding: 2rem;
    text-align: center;
    color: #6b7280;
    font-style: italic;
}

/* Error Content Styles */
.error-content {
    color: #ef4444;
    padding: 1rem;
    border: 1px solid #fecaca;
    border-radius: 0.5rem;
    background: #fef2f2;
}

.error-content .font-semibold {
    font-weight: 600;
    color: #991b1b;
}

.error-content .text-sm {
    font-size: 0.875rem;
    color: #b91c1c;
}

/* Responsive Design */
@media (max-width: 768px) {
    .learning-content h1 {
        font-size: 1.875rem;
    }

    .learning-content h2 {
        font-size: 1.5rem;
    }

    .learning-content h3 {
        font-size: 1.25rem;
    }

    .learning-content pre {
        padding: 1rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 480px) {
    .learning-content h1 {
        font-size: 1.5rem;
    }

    .learning-content h2 {
        font-size: 1.25rem;
    }

    .learning-content h3 {
        font-size: 1.125rem;
    }

    .learning-content h4 {
        font-size: 1rem;
    }

    .learning-content ul,
    .learning-content ol {
        padding-left: 1.5rem;
    }

    .learning-content blockquote {
        padding: 0.75rem 1rem;
        margin: 1rem 0;
    }
}

/* Animation Enhancements */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* Enhanced Concept Card Styles */
.concept-card {
    transition: all 0.3s ease;
}

.concept-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}


/* Additional Concept Card Enhancements */
.concept-card .loading-content {
    animation: fadeIn 0.5s ease-out;
}

.concept-card .error-content {
    animation: slideUp 0.3s ease-out;
}


/* Learning Content Print Styles */
@media print {
    .concept-card {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #e5e7eb;
    }

    .concept-card:hover {
        transform: none;
        box-shadow: none;
    }

    .learning-content {
        color: #000;
    }

    .learning-content a {
        color: #000;
        text-decoration: underline;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .concept-card {
        border: 2px solid #000;
    }

    .learning-content {
        color: #000;
    }

    .learning-content h1,
    .learning-content h2,
    .learning-content h3,
    .learning-content h4 {
        color: #000;
        border-bottom-color: #000;
    }

    .learning-content blockquote {
        border-left-color: #000;
        background: #fff;
        color: #000;
    }

    .learning-content code {
        background: #000;
        color: #fff;
        border: 1px solid #000;
    }

    .learning-content pre {
        background: #000;
        color: #fff;
        border: 1px solid #000;
    }

    .math-error {
        border-color: #000;
        color: #000;
        background: #fff;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .concept-card {
        transition: none;
    }

    .concept-card:hover {
        transform: none;
        box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    }

    .concept-card .loading-content {
        animation: none;
    }

    .concept-card .error-content {
        animation: none;
    }
}

/* Focus Management for Accessibility */

.concept-card:focus-within {
    outline: 2px solid #4A9B8E;
    outline-offset: 2px;
}

/* Sub-concept Navigation Styles */
.sub-concept-navigation {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.sub-concept-navigation .progress-dots {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sub-concept-navigation .progress-dots .w-2 {
    height: 0.5rem;
    background: #d1d5db;
    border-radius: 9999px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.sub-concept-navigation .progress-dots .w-2.bg-blue-500 {
    background: #3b82f6;
    width: 2rem;
}

.sub-concept-navigation .progress-dots .w-2.bg-green-500 {
    background: #10b981;
}

.sub-concept-navigation .progress-dots .w-2:hover {
    transform: scale(1.2);
}

.sub-concept-navigation .text-sm {
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: rgba(255, 255, 255, 0.8);
}

/* Voice Assistant Container Styles */
.voice-assistant-container {
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    background: #f9fafb;
    border: 1px solid #e5e7eb;
}

.voice-assistant-container iframe {
    border: none;
    width: 100%;
    height: 16rem;
}

/* Sub-concept Button Styles */
.sub-concept-content button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Improved button spacing for mobile */
@media (max-width: 768px) {
    .sub-concept-content .flex.items-center.justify-between {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .sub-concept-content button {
        width: 100%;
    }

    .voice-assistant-container iframe {
        height: 12rem;
    }

    .sub-concept-navigation {
        flex-direction: column;
        gap: 0.75rem;
        align-items: center;
    }

    .sub-concept-navigation .progress-dots {
        order: 2;
    }

    .sub-concept-navigation .text-sm {
        order: 1;
    }
}

/* Enhanced focus management for accessibility */
.sub-concept-navigation .progress-dots .w-2:focus,
.sub-concept-content button:focus {
    outline: 2px solid #4A9B8E;
    outline-offset: 2px;
}

/* Animation for sub-concept content transitions */
@keyframes slideInFromBottom {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sub-concept-content {
    animation: slideInFromBottom 0.3s ease-out;
}

/* Reduced motion support for sub-concept navigation */
@media (prefers-reduced-motion: reduce) {
    .sub-concept-navigation .progress-dots .w-2 {
        transition: none;
    }

    .sub-concept-content button {
        transition: none;
    }

    .sub-concept-content {
        animation: none;
    }
}

/* Voice Assistant Styles */
.voice-assistant-container {
    position: relative;
    width: 100%;
}

/* Voice Assistant Placeholder */
.voice-assistant-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 16rem;
    /* h-64 */
    background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
    border: 2px dashed #93c5fd;
    border-radius: 1rem;
    transition: all 0.3s ease;
}

.voice-assistant-placeholder:hover {
    border-color: #3b82f6;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
}

.voice-assistant-illustration {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem;
}

/* Voice Assistant Loader */
.voice-loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: #f9fafb;
    border-radius: 1rem;
    border: 2px solid #e5e7eb;
    z-index: 10;
    transition: opacity 0.3s ease;
}

.voice-loader.hidden {
    opacity: 0;
    pointer-events: none;
}

/* Voice Assistant Close Button */
.voice-assistant-close {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 32px;
    height: 32px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    z-index: 20;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.3);
}

.voice-assistant-close:hover {
    background: #dc2626;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

.voice-assistant-close:active {
    transform: scale(0.95);
}

/* Loader Spinner */
.loader-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e5e7eb;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    100% {
        transform: rotate(360deg);
    }
}

/* ===== MARKDOWN TABLE STYLES ===== */
/* Modern, professional table styling for marked.js output */
.learning-content table {
    width: 100%;
    margin: 2rem 0;
    background: linear-gradient(135deg, #ffffff 0%, #fafbfc 100%);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02),
        0 2px 4px -1px rgba(0, 0, 0, 0.01),
        0 0 0 1px rgba(0, 0, 0, 0.02);
    border-collapse: separate;
    border-spacing: 0;
    position: relative;
}

/* Add subtle border */
.learning-content table::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #4A9B8E 0%, #6B4C93 50%, #FF6B6B 100%);
    z-index: 1;
}

.learning-content th,
.learning-content td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    border-right: 1px solid rgba(0, 0, 0, 0.06);
    position: relative;
    transition: all 0.2s ease;
}

/* Remove right border from last column */
.learning-content th:last-child,
.learning-content td:last-child {
    border-right: none;
}

/* Header styling with modern look */
.learning-content th {
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    font-weight: 700;
    color: #0f172a;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(74, 155, 142, 0.2);
    position: relative;
}

/* Add subtle accent to headers */
.learning-content th::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, #4A9B8E 20%, #4A9B8E 80%, transparent);
}

/* Enhanced row styling */
.learning-content tr:nth-child(even) {
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.5) 0%, rgba(241, 245, 249, 0.5) 100%);
}

.learning-content tr:nth-child(odd) {
    background: transparent;
}

/* Modern hover effect */
.learning-content tbody tr {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.learning-content tbody tr:hover {
    background: linear-gradient(135deg, rgba(74, 155, 142, 0.03) 0%, rgba(107, 76, 147, 0.03) 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.02);
}

/* First and last cell special rounding */
.learning-content tr:first-child th:first-child {
    border-top-left-radius: 12px;
}

.learning-content tr:first-child th:last-child {
    border-top-right-radius: 12px;
}

.learning-content tr:last-child td:first-child {
    border-bottom-left-radius: 12px;
}

.learning-content tr:last-child td:last-child {
    border-bottom-right-radius: 12px;
}

/* Remove bottom border from last row */
.learning-content tr:last-child td {
    border-bottom: none;
}

/* Code block styling - FIXED for better visibility */
.learning-content pre {
    background: #1e293b !important;
    color: #e2e8f0 !important;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 1rem 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre;
    border: 1px solid #334155;
}

.learning-content pre code {
    background: none !important;
    color: inherit !important;
    padding: 0;
    border-radius: 0;
}

.learning-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9em;
    color: #d1242f;
}

/* Inline code in tables and headings */
.learning-content td code,
.learning-content th code,
.learning-content h1 code,
.learning-content h2 code,
.learning-content h3 code,
.learning-content h4 code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}

/* Horizontal rule styling */
.learning-content hr {
    border: none;
    border-top: 2px solid #e1e4e8;
    margin: 2rem 0;
}

/* Link styling */
.learning-content a {
    color: #0969da;
    text-decoration: none;
    transition: color 0.2s ease;
}

.learning-content a:hover {
    color: #0550ae;
    text-decoration: underline;
}

/* Responsive tables */
@media (max-width: 768px) {
    .learning-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    }

    .learning-content th,
    .learning-content td {
        padding: 12px 16px;
        font-size: 0.875rem;
        border-right: 1px solid rgba(0, 0, 0, 0.08);
    }

    .learning-content th {
        font-size: 0.75rem;
        letter-spacing: 0.025em;
        border-right: 1px solid rgba(0, 0, 0, 0.1);
    }

    /* Adjust gradient border for mobile */
    .learning-content table::before {
        height: 2px;
    }
}

@media (max-width: 480px) {

    .learning-content th,
    .learning-content td {
        padding: 10px 12px;
        font-size: 0.8rem;
    }

    .learning-content th {
        font-size: 0.7rem;
    }
}

/* Print styles for tables */
@media print {
    .learning-content table {
        box-shadow: none;
        border: 1px solid #d0d7de;
        background: white !important;
    }

    .learning-content table::before {
        display: none;
    }

    .learning-content th,
    .learning-content td {
        border: 1px solid #d0d7de;
        color: #000;
        padding: 8px 12px;
    }

    .learning-content th {
        background: #f6f8fa !important;
        font-weight: 600;
    }

    .learning-content tr:nth-child(even) {
        background: #f9f9f9 !important;
    }

    .learning-content tbody tr:hover {
        transform: none;
        box-shadow: none;
        background: #f9f9f9 !important;
    }

    /* Ensure proper rounding */
    .learning-content tr:first-child th:first-child,
    .learning-content tr:first-child th:last-child,
    .learning-content tr:last-child td:first-child,
    .learning-content tr:last-child td:last-child {
        border-radius: 0;
    }
}