:root {
    --color-bg: #ffffff;
    --color-surface: #f6f8fc;
    --color-card: #ffffff;
    --color-panel: #f5f8ff;
    --color-panel-alt: #f0f8ff;
    --color-overlay: #333333;
    --color-text: #111827;
    --color-text-muted: #4b5563;
    --color-text-soft: #6b7280;
    --color-text-inverse: #ffffff;
    --color-border: #e5e7eb;
    --color-border-light: #e9ecef;
    --color-border-muted: #e0e0e0;
    --color-border-subtle: #cccccc;
    --color-border-contrast: #dbeafe;
    --color-surface-muted: #f0f0f0;
    --color-surface-neutral: #dddddd;
    --color-accent-strong: #6a11cb;
    --color-info-text: #343a40;
    --color-info-muted: #888888;
    --color-danger-strong: #b10000;
    --color-danger-soft: #ffe5e5;
    --color-pill: #007bff;
    --color-input-bg: #f5f5f5;
    --color-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    --color-overlay-light: rgba(255, 255, 255, 0.3);
    --color-overlay-strong: rgba(255, 255, 255, 0.8);
    --color-footer-bg: #342f4a;
    --color-footer-chip: #374151;
    --color-heart: #ef4444;
    --color-success-soft: #e6ffed;
    --color-success-border: #b5f5c1;
    --button-shadow: 0 12px 28px rgba(117, 85, 255, 0.25);
    --button-secondary-bg: rgba(15, 76, 129, 0.08);
    --button-secondary-color: #0f172a;

    --primary: #75f;
    --primary-dark: rgb(90, 56, 225);
    --primary-contrast: #ffffff;

    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #dc2626;

    --text: var(--color-text);
    --text-light: var(--color-text-muted);
    --background: var(--color-bg);
    --secondary-background: var(--color-surface);
    --border: var(--color-border);
    --radius: 8px;
    --shadow: var(--color-shadow);
}

[data-theme='dark'] {
    --color-bg: #0b1633;
    --color-surface: #101f3f;
    --color-card: #14254b;
    --color-panel: #152a59;
    --color-panel-alt: #1a356d;
    --color-overlay: rgba(255, 255, 255, 0.1);
    --color-text: #f4f6ff;
    --color-text-muted: #a4b0cf;
    --color-text-soft: #c3cce4;
    --color-text-inverse: #050b1b;
    --color-border: #1f2948;
    --color-border-light: #25325a;
    --color-border-muted: #2e3b66;
    --color-border-subtle: #3c4a77;
    --color-border-contrast: #273863;
    --color-surface-muted: #1a2b56;
    --color-surface-neutral: #25325a;
    --color-accent-strong: #b4c5ff;
    --color-info-text: #e2e8ff;
    --color-info-muted: #b6c2e4;
    --color-danger-strong: #ffc2c2;
    --color-danger-soft: #4b1b1b;
    --color-pill: #dbe4ff;
    --color-input-bg: #1d2d58;
    --color-shadow: 0 20px 40px rgba(5, 9, 24, 0.65);
    --color-overlay-light: rgba(255, 255, 255, 0.35);
    --color-overlay-strong: rgba(11, 22, 51, 0.9);
    --color-footer-bg: #050b1b;
    --color-footer-chip: #0f1e3c;
    --color-heart: #f87171;
    --color-success-soft: #133527;
    --color-success-border: #1f5136;
    --button-shadow: 0 14px 30px rgba(1, 5, 15, 0.8);
    --button-secondary-bg: rgba(255, 255, 255, 0.08);
    --button-secondary-color: #f4f6ff;

    --primary: #ffffff;
    --primary-dark: #dbe4ff;
    --primary-contrast: #0b1633;

    --success: #4ade80;
    --warning: #facc15;
    --danger: #f87171;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
        Roboto, sans-serif;
    line-height: 1.5;
    background-color: var(--background);
    color: var(--text);
}

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

/* Button Styles */
.btn {
    background: var(--primary);
    color: var(--primary-contrast);
    display: inline-block;
    width: 12rem;
    transition: background 0.3s, color 0.3s, transform 0.3s;
    margin: 0px 6px 6px 0px;
    padding: 15px 30px;
    box-sizing: border-box;
    border-radius: 3px;
    box-shadow: var(--button-shadow);
    position: relative;
    border: none;
}

.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: rgba(0, 0, 0, 0.12);
    opacity: 0;
    transition: opacity 0.3s;
}

.btn:hover::before {
    opacity: 1;
}

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

.btn-secondary {
    background: var(--button-secondary-bg);
    color: var(--button-secondary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-dark);
    color: var(--primary-contrast);
}

/* Grid Layouts */
.chunk-grid,
.cards-grid,
.testimonials-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
}

/* Cards */
.chunk-card,
.chunk-card,
.single-card {
    background: var(--color-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.chunk-card:hover,
.single-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Section Styles */

.grid-content {
    padding: 3rem 0 0 0;
    background: var(--background);
}
.cards-section {
    padding: 6rem 0;
    background: var(--background);
}
.section-header,
.header-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.chunks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
.section-title,
.main-heading {
    font-size: 3.5rem;
    font-weight: 800;
    line-height: 1.2;
    margin: 0;
    color: var(--color-text);
    padding-right: 40px;
}

.section-description,
.main-description {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
    padding-top: 8px;
}

.chunk-item h3,
.single-card h3 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--color-text);
}

.chunk-item p,
.single-card p {
    font-size: 1.125rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    margin: 0;
}

.card-image {
    width: 100%;
    height: 250px;
    object-fit: cover;
    border-radius: 8px;
    transition: transform 0.3s ease;
    margin-bottom: 10px;
}

.single-card:hover .card-image {
    transform: scale(1.02);
}

.learn-more {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    transition: color 0.3s ease;
}

.learn-more:hover {
    color: var(--primary-dark);
}

/* Animation classes */
.animate-item {
    opacity: 0;
    transform: translateY(1rem);
    transition: opacity 0.2s ease, transform 0.5s ease;
}

.animate-item.animate-in,
.animate-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.cards-grid .animate-item,
.testimonials-grid .animate-item {
    transition-delay: calc(var(--item-index) * 0.1s);
}

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

@keyframes heartbeat {
    0%,
    100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* tooltip styles */
.custom-tooltip {
    position: relative;
    display: inline-block;
}

.custom-tooltip .tooltiptext {
    visibility: hidden;
    width: 100px;
    background-color: var(--color-overlay);
    color: var(--color-text-inverse);
    text-align: center;
    padding: 5px 5px;
    border-radius: 6px;
    font-size: 12px;
    /* Position the tooltip text - see examples below! */
    position: absolute;
    z-index: 2000;
}

.custom-tooltip .tooltiptext {
    width: 100px;
    bottom: 120%;
    left: 50%;
    margin-left: -50px;
    font-size: 0.8rem;
    font-weight: 200;
    visibility: hidden;
}

.custom-tooltip .tooltiptext::after {
    content: " ";
    position: absolute;
    top: 100%; /* At the bottom of the tooltip */
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: var(--color-overlay) transparent transparent transparent;
}

.custom-tooltip .tooltiptext {
    opacity: 0;
    transition: opacity 1s;
}

.custom-tooltip:hover .tooltiptext {
    opacity: 1;
}

.custom-tooltip.show-tooltip .tooltiptext {
    visibility: visible;
    opacity: 1;
}

.main-description a {
    color: var(--primary); /* or any color like #0056b3 for a blue link */
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.3s ease;
}

.main-description a:hover {
    color: #003366; /* darker shade on hover */
}

.custom-tooltip-favorite {
    position: relative;
    display: inline-block;
}

.tooltiptext-favorite {
    font-size: 10px;
    visibility: hidden;
    background-color: var(--color-overlay);
    color: var(--color-text-inverse);
    text-align: center;
    border-radius: 6px;
    padding: 5px 8px;
    position: absolute;
    z-index: 100;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    opacity: 0;
    transition: opacity 0.3s;
    margin-top: 0.5rem;
}

.tooltiptext-favorite::after {
    content: "";
    position: absolute;
    bottom: 100%;
    left: 50%;
    margin-left: -5px;
    border-width: 5px;
    border-style: solid;
    border-color: transparent transparent var(--color-overlay) transparent;
}

.tooltiptext-favorite.show {
    visibility: visible;
    opacity: 1;
}

/* table styles */
table,
th,
td {
    border: 1px solid black;
}

td,
th {
    text-align: center; /* centrează orizontal */
    vertical-align: middle; /* centrează vertical */
    padding: 8px; /* opțional: spațiere */
}

/* Responsive styles */
@media (max-width: 1024px) {
    .section-title,
    .main-heading,
    .testimonials-header h2,
    .faq-header h2 {
        font-size: 2.5rem;
    }

    .section-header,
    .header-grid {
        gap: 2rem;
    }

    .cards-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 1rem;
    }

    li,
    p {
        font-size: 16px;
    }

    span {
        font-size: 14px;
    }

    .single-card p {
        font-size: 16px;
    }
    .section-description,
    .main-description {
        font-size: 16px;
    }
    .nav-links,
    .section-header {
        display: none;
    }

    .header-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .hero h1 {
        font-size: 2.5rem !important;
    }

    h2 {
        font-size: 2.1rem !important;
    }

    /* h3 {
        font-size: 1.6rem !important;
    } */

    .single-card {
        padding: 1.3rem;
    }
    .main-heading {
        padding-right: 0;
    }

    .chunk-grid,
    .cards-grid,
    .testimonials-grid,
    .chunks-grid {
        grid-template-columns: 1fr;
    }

    .card-image {
        height: 200px;
    }

    .footer-content,
    .footer-bottom {
        flex-direction: column;
        gap: 40px;
    }

    .footer-links {
        gap: 30px;
    }

    .footer-bottom {
        text-align: center;
    }

    .faq-question span {
        font-size: 18px;
    }
}

/* loading styles */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    /* Use the --vh variable set in JS to avoid mobile browser chrome issues */
    height: calc(var(--vh, 1vh) * 100);
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: visibility 0s, opacity 0.3s;
}

.loading-overlay.show {
    visibility: visible;
    opacity: 1;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 6px solid rgba(0, 0, 0, 0.2);
    border-top-color: #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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



.addFavorite {
    background: none;
    color: var(--primary);
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.3s ease;
    display: flex;
    justify-content: center;
    align-self: flex-start;
    /* Align to the top */
    padding-top: 2rem;
    transition: transform 0.2s, color 0.3s ease;
}

.addFavorite:hover {
    transform: scale(1.2);
}


  .lesson { font-family: Arial, sans-serif; line-height: 1.55; max-width: 980px; margin: 18px auto; padding: 0 14px; }
  .card { border: 1px solid #e5e7eb; border-radius: 14px; padding: 12px 14px; margin: 10px 0; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
  .kbox { border-left: 4px solid #111827; padding-left: 10px; margin: 10px 0; }
  .soft { color: #374151; }
  .formula { border: 1px dashed #cbd5e1; border-radius: 12px; padding: 10px 12px; margin: 10px 0; }
  .exampleTitle { font-weight: 700; margin-bottom: 6px; }
  .mini { font-size: 13px; color: #374151; }
  .solution { border: 1px solid #e5e7eb; border-radius: 12px; padding: 10px 12px; margin: 6px 0 14px; }


/* Allow inline MathJax to wrap instead of overflow */
mjx-container[jax="CHTML"][display="false"] {
  white-space: normal !important;
}

mjx-container[jax="CHTML"] {
  overflow-x: auto;
  overflow-y: hidden;
  max-width: 100%;
}

/* Remove focus shadow & outline globally */
button:focus,
button:active,
button:focus-visible,
a:focus,
a:active,
a:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}