/* Custom styles for TEENFIT */

/* Design Palette */
:root {
    --color-primary: #55C3ED;
    /* brand primary */
    --color-secondary: #DD3635;
    /* brand secondary */
    --color-text: #7A7A7A;
    /* base text */
    --color-accent: #61CE70;
    /* accent */
}

/* Portal background gradient (no inline styles due to CSP) */
/* body.portal-bg {
    background: linear-gradient(180deg, rgba(85, 195, 237, 0.2) 0%, rgba(85, 195, 237, 0.05) 100%) !important;
} */

/* Content area default spacing and transition placeholder */
#portal-content.portal-content-placeholder {
    margin: auto;
    max-width: 1350px;
    min-height: 40vh;
}

.navbar-toggler:focus {
    text-decoration: none;
    outline: 0;
    box-shadow: 0 0 0 1px var(--bs-navbar-toggler-border-color);
}

/* Progress components */
.progress-item {
    padding: 1rem;
}

.progress-circle {
    width: 80px;
    height: 80px;
    margin: 0 auto;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.progress-thin {
    height: 8px !important;
}

.progress-thinner {
    height: 5px !important;
}

.icon-opacity-3 {
    opacity: 0.3 !important;
}

/* Timeline styles */
.timeline {
    position: relative;
    padding-left: 2rem;
}

.timeline-item {
    position: relative;
    margin-bottom: 1.5rem;
}

.timeline-item:not(:last-child)::before {
    content: '';
    position: absolute;
    left: -1.5rem;
    top: 1.5rem;
    width: 2px;
    height: calc(100% + 0.5rem);
    background-color: #e9ecef;
}

.timeline-marker {
    position: absolute;
    left: -1.75rem;
    top: 0.25rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px #e9ecef;
}

.timeline-content {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 0.5rem;
    border-left: 3px solid #28a745;
}

/* Questionnaire status styles */
.questionnaire-status {
    border-radius: 0.5rem;
    padding: 0.75rem;
    text-align: center;
    font-weight: 600;
}

.questionnaire-status.success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.questionnaire-status.warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

.questionnaire-status.info {
    background-color: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

.questionnaire-status.danger {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Card header colors */
.card-header.bg-success {
    background-color: #28a745 !important;
}

.card-header.bg-warning {
    background-color: #ffc107 !important;
    color: #212529 !important;
}

.card-header.bg-info {
    background-color: #17a2b8 !important;
}

.card-header.bg-danger {
    background-color: #dc3545 !important;
}

/* Border utilities */
.border-left-primary {
    border-left: 0.25rem solid #007bff !important;
}

.border-left-success {
    border-left: 0.25rem solid #28a745 !important;
}

.border-left-info {
    border-left: 0.25rem solid #17a2b8 !important;
}

.border-left-warning {
    border-left: 0.25rem solid #ffc107 !important;
}

.border-left-danger {
    border-left: 0.25rem solid #dc3545 !important;
}

/* Text utilities */
.text-gray-800 {
    color: #5a5c69 !important;
}

.text-gray-300 {
    color: #dddfeb !important;
}

/* Animation utilities */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

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

/* Icon utilities */
.icon-2x {
    font-size: 2rem !important;
}

.icon-3x {
    font-size: 3rem !important;
}

.icon-4x {
    font-size: 4rem !important;
}

/* Visibility utilities */
.hidden {
    display: none !important;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .timeline {
        padding-left: 1rem;
    }

    .timeline-marker {
        left: -1.25rem;
    }

    .timeline-item:not(:last-child)::before {
        left: -1rem;
    }

    .questionnaire-status {
        font-size: 0.875rem;
        padding: 0.5rem;
    }

    .card-title {
        font-size: 1.1rem;
    }

    .progress-circle {
        width: 60px;
        height: 60px;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }

    .card {
        border: 1px solid #dee2e6 !important;
        page-break-inside: avoid;
    }
}

.user-pair-teen {
    border-left: 4px solid #17a2b8 !important;
    background-color: rgba(23, 162, 184, 0.05);
}

.user-id-parent {
    color: #28a745 !important;
    font-weight: bold;
}

.user-id-teen {
    color: #17a2b8 !important;
    font-weight: bold;
}

.linked-user-info {
    font-size: 0.75rem;
    color: #6c757d;
    font-style: italic;
}

/* Theme System - Dark Mode */
[data-theme="dark"] {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #ffffff;
    --bs-primary: #0d6efd;
    --bs-secondary: #6c757d;
    --bs-success: #198754;
    --bs-info: #0dcaf0;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #f8f9fa;
    --bs-dark: #212529;
}

[data-theme="dark"] body {
    background-color: #1a1a1a;
    color: #ffffff;
}

[data-theme="dark"] .navbar {
    background-color: #0d1117 !important;
}

[data-theme="dark"] .card {
    background-color: #21262d;
    border-color: #30363d;
    color: #ffffff;
}

[data-theme="dark"] .card-header {
    background-color: #161b22;
    border-color: #30363d;
    color: #ffffff;
}

[data-theme="dark"] .table {
    --bs-table-bg: #21262d;
    --bs-table-color: #ffffff;
    --bs-table-border-color: #30363d;
    --bs-table-striped-bg: #161b22;
    --bs-table-hover-bg: #30363d;
}

[data-theme="dark"] .table thead th {
    background-color: #161b22;
    border-color: #30363d;
    color: #ffffff;
}

[data-theme="dark"] .btn-outline-primary {
    color: #0d6efd;
    border-color: #0d6efd;
}

[data-theme="dark"] .btn-outline-primary:hover {
    background-color: #0d6efd;
    color: #ffffff;
}

[data-theme="dark"] .btn-outline-warning {
    color: #ffc107;
    border-color: #ffc107;
}

[data-theme="dark"] .btn-outline-warning:hover {
    background-color: #ffc107;
    color: #000000;
}

[data-theme="dark"] .btn-outline-danger {
    color: #dc3545;
    border-color: #dc3545;
}

[data-theme="dark"] .btn-outline-danger:hover {
    background-color: #dc3545;
    color: #ffffff;
}

[data-theme="dark"] .form-control {
    background-color: #21262d;
    border-color: #30363d;
    color: #ffffff;
}

[data-theme="dark"] .form-control:focus {
    background-color: #21262d;
    border-color: #0d6efd;
    color: #ffffff;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

[data-theme="dark"] .form-select {
    background-color: #21262d;
    border-color: #30363d;
    color: #ffffff;
}

[data-theme="dark"] .input-group-text {
    background-color: #30363d;
    border-color: #30363d;
    color: #ffffff;
}

[data-theme="dark"] .dropdown-menu {
    background-color: #21262d;
    border-color: #30363d;
}

[data-theme="dark"] .dropdown-item {
    color: #ffffff;
}

[data-theme="dark"] .dropdown-item:hover {
    background-color: #30363d;
    color: #ffffff;
}

[data-theme="dark"] .text-gray-800 {
    color: #ffffff !important;
}

[data-theme="dark"] .text-muted {
    color: #8b949e !important;
}

[data-theme="dark"] .border-left-primary {
    border-left-color: #0d6efd !important;
}

[data-theme="dark"] .border-left-success {
    border-left-color: #198754 !important;
}

[data-theme="dark"] .border-left-info {
    border-left-color: #0dcaf0 !important;
}

[data-theme="dark"] .border-left-warning {
    border-left-color: #ffc107 !important;
}

/* Theme Toggle Button */
.theme-toggle {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    padding: 0.5rem;
    border-radius: 0.375rem;
    transition: background-color 0.15s ease-in-out;
}

.theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .theme-toggle:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

/* Default Light Theme - Ensure white background */
body {
    background-color: #ffffff !important;
    color: #212529 !important;
}

main.container-fluid {
    background-color: #ffffff !important;
}

main {
    background-color: #ffffff !important;
}

/* Ensure consistent white background for all dashboard pages */
.dashboard-page {
    background-color: #ffffff !important;
    min-height: 100vh;
}

/* Navbar container should always be transparent */
.navbar .container-fluid {
    background-color: transparent !important;
    align-items: baseline;
}

/* Portal navbar active link color */
.navbar .nav-link.active,
.navbar .nav-link[aria-current="page"] {
    color: #DD3635 !important;
}

.navbar .nav-link.active .mdi,
.navbar .nav-link[aria-current="page"] .mdi {
    color: #DD3635 !important;
}

/* Hover/focus state matching brand red */
/* .navbar .nav-link:hover,
.navbar .nav-link:focus {
    color: #DD3635 !important;
}
.navbar .nav-link:hover .mdi,
.navbar .nav-link:focus .mdi {
    color: #DD3635 !important;
} */

/* Only main content containers should have background colors */
main.container-fluid {
    background-color: #ffffff !important;
}

html[data-theme="dark"] main.container-fluid {
    background-color: #1a1a1a !important;
}

/* Better text-muted color for light theme */
.text-muted,
html[data-theme="light"] .text-muted,
html:not([data-theme]) .text-muted {
    color: #495057 !important;
    /* Darker grey for better readability */
}

/* Keep original muted color for dark theme */
html[data-theme="dark"] .text-muted {
    color: #8b949e !important;
}

html[data-theme="light"] .text-gray-800,
html:not([data-theme]) .text-gray-800 {
    color: #dee2e6 !important;
    /* Bootstrap gray-300 - light grey for stats numbers */
}

/* Keep original colors for dark theme */
html[data-theme="dark"] .text-gray-300 {
    color: #dee2e6 !important;
}

html[data-theme="dark"] .text-gray-800 {
    color: #ffffff !important;
    /* White for dark theme */
}

/* Ensure stats numbers are visible in light theme */
html[data-theme="light"] .h5.text-gray-800,
html:not([data-theme]) .h5.text-gray-800 {
    color: #6c757d !important;
    /* Slightly darker gray-500 for better visibility */
}

/* --- Portal page overrides ---
   The general rules above force white backgrounds on body/main.
   For portal pages we want a gradient on body and transparent content bg. */
/* body.portal-bg {
    background: linear-gradient(180deg, rgba(85, 195, 237, 0.2) 0%, rgba(85, 195, 237, 0.05) 100%) !important;
} */
body.portal-bg main,
body.portal-bg main.container-fluid {
    background-color: transparent !important;
}

/* --- Portal: force single light scheme and fixed card styles --- */
/* Ignore system/browser color scheme on portal */
body.portal-bg {
    color-scheme: light;
}

/* Ensure common surfaces stay light on portal, regardless of dark mode rules */
body.portal-bg,
body.portal-bg .navbar,
body.portal-bg .home-header,
body.portal-bg .home-navbar,
body.portal-bg .card,
body.portal-bg .card-header,
body.portal-bg .table {
    background-color: #ffffff77 !important;
    color: #212529 !important;
}

/* Questionnaires cards background color as specified */
body.portal-bg .questionnaires-cards .card {
    background-color: #E2E8F0A1 !important;
    /* semi-transparent slate */
}

/* Keep badges and buttons readable on the new card background */
body.portal-bg .questionnaires-cards .badge {
    mix-blend-mode: normal;
}

/* --- Questionnaire status icon color utilities --- */
.status-icon {
    vertical-align: middle;
}

.status-icon.completed {
    color: #16A34A !important;
}

/* green-600 */
.status-icon.available {
    color: #198754 !important;
}

/* bootstrap success */
.status-icon.paused {
    color: #F59E0B !important;
}

/* amber-500 */
.status-icon.locked {
    color: #6C757D !important;
}

/* bootstrap secondary */
.status-icon.scheduled {
    color: #0D6EFD !important;
}

/* bootstrap primary */
.status-icon.expired {
    color: #DC2626 !important;
}

/* red-600 */

/* Stats card numbers specifically */
html[data-theme="light"] .card-body .text-gray-800,
html:not([data-theme]) .card-body .text-gray-800 {
    color: #6c757d !important;
    /* Gray-500 for better readability */
}

/* Password Strength Indicator */
.password-strength-progress {
    height: 5px !important;
}

/* --- Portal HOME: Modulview layout (exact 4-up, no gaps) --- */
#modulview {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    /* no extra distribution */
    align-items: center;
    gap: 0;
    /* no gaps between images */
    padding: 0;
    /* no edge padding */
    margin: 0;
    /* no margins */
    width: 100%;
}

/* Each module tile scales responsively and fits within the viewport width */
/* When images are direct children (no tile wrappers) */

#modulview>.modulImg {
    display: block;
    position: relative;
    flex: 0 0 25%;
    width: 25%;
    max-width: 25%;
    height: auto;
    cursor: pointer;
    transition: transform .15s ease-in-out;
}

#modulview>.modulImg:hover {
    transform: scale(1.15);
    z-index: 2;
}

/* md and below (<=768px): 2 columns (50% each), wrap to 2 rows */
@media (max-width: 768px) {
    #modulview>.modulImg {
        flex: 0 0 50%;
        width: 50%;
        max-width: 50%;
    }
}

/*  (<400px): 1 column (100%), 4 rows */
@media (max-width: 400px) {
    #modulview>.modulImg {
        flex: 0 0 100%;
        width: 100%;
        max-width: 100%;
    }
}

/* SVG arc overlays the tile, matching its size */
/* If arc SVGs are reintroduced within wrappers, add styles back here. */

/* Flex handles responsiveness automatically with clamp widths. */

/* No active module styling anymore */

.password-strength-width-0 {
    width: 0% !important;
}

.password-strength-width-20 {
    width: 20% !important;
}

.password-strength-width-40 {
    width: 40% !important;
}

.password-strength-width-60 {
    width: 60% !important;
}

.password-strength-width-80 {
    width: 80% !important;
}

.password-strength-width-100 {
    width: 100% !important;
}

/* --- Homepage Styles --- */
.home-header {
    background-color: #ffffff;
    line-height: 0;
    /* remove gaps around full-width image */
    overflow: hidden;
}

.home-head-banner {
    width: 100%;
    min-width: 700px;
    height: auto;
    display: block;
}

.home-hero {
    line-height: 0;
    /* remove whitespace gap */
}

.home-hero-img {
    width: 100%;
    height: auto;
    display: block;
}

/* Language switch styles */
.lang-switch,
.lang-switch-inline {
    z-index: 1040;
    /* above header image and under navbar overlay */
    right: 5.5vw;
    top: -2px;
}

.lang-btn {
    --lang-brand: var(--color-secondary);
    color: var(--lang-brand);
    border: 1px solid var(--lang-brand);
    background-color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    letter-spacing: 0.5px;
}

.lang-btn:hover,
.lang-btn:focus {
    color: #fff !important;
    background-color: var(--lang-brand) !important;
    border-color: var(--lang-brand) !important;
}

.lang-btn.active,
.lang-btn.active:hover,
.lang-btn.active:focus {
    color: #fff !important;
    background-color: var(--lang-brand) !important;
    border-color: var(--lang-brand) !important;
}

.home-content .home-section {
    scroll-margin-top: 90px;
    /* compensate sticky navbar */
}

.home-section {
    position: relative;
}

/* Footer overlay image used on homepage and portal */
.home-page .footer-overlay,
body.portal-bg .footer-overlay {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    /* allow clicks to pass through */
    display: flex;
    justify-content: center;
    z-index: 1030;
    /* above content and navbar */
    overflow: hidden;
    /* prevent horizontal scroll when image overflows */
}

.home-page .footer-overlay-img,
body.portal-bg .footer-overlay-img {
    width: 100vw;
    /* full width */
    height: auto;
    opacity: 0.95;
    display: block;
}

/* Ensure bottom spacing on homepage so content isn't covered by overlay */
.home-page {
    padding-bottom: 120px;
    /* adjusted to approximate overlay height */
}

@media (max-width: 576px) {
    .video-grid {
        gap: 0.75rem;
    }
}

.dev-footer {
    position: sticky;
    bottom: 10px;
    z-index: 4000;
    margin: auto;
    width: auto;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border-radius: 1rem;
    padding: 0.25rem 0.5rem !important;
    pointer-events: auto;
}

/* --- Portal Material: Video grid --- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem 2.5rem;
}

/* Center items only for games grid */
#gamesGrid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 220px));
    justify-content: center;
}

/* Material menu styling */
#materialMenu {

    flex-wrap: wrap;
}

#materialContent .accordion-item {
    border: none;
    max-width: 700px;
    margin: auto;
    border-radius: 12px;
    overflow: hidden;
}

#materialContent .accordion-button {
    font-weight: 600;
}

#materialContent .accordion-button:not(.collapsed) {
   background-color: #F3F4F6;
   box-shadow: none;
}

#materialContent .accordion-button:focus {
    box-shadow: none;
}


#materialContent .accordion-button img {
    height: 80px;
    width: auto;
}

#materialContent .accordion-body {
    background-color: #f9f9f9;
}


#materialMenu .nav-link {
    --brand: #DD3635;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .7rem 2rem;
    /* border-radius: 999px; */
    /* border: 1px solid rgba(0,0,0,.08); */
    background: #F3F4F6;
    /* gray-100 */
    color: #212529;
    font-weight: 600;
    line-height: 1;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, border-color .15s ease, transform .05s ease;
    text-decoration: none;
}

#materialMenu .nav-item:first-of-type a {
    border-top-left-radius: 300px;
    border-bottom-left-radius: 300px;
}

#materialMenu .nav-item:last-of-type a {
    border-top-right-radius: 300px;
    border-bottom-right-radius: 300px;
}

#materialMenu .nav-link:hover {
    background: #E5E7EB;
    /* gray-200 */
    border-color: rgba(0, 0, 0, .1);
}

#materialMenu .nav-link:focus {
    outline: none;
    /* box-shadow: 0 0 0 3px rgba(221,54,53,.2); */
}

#materialMenu .nav-link.active,
#materialMenu .nav-link[aria-current="page"] {
    background: var(--brand);
    color: #fff !important;
    border-color: var(--brand);
}

#materialMenu .nav-link.active:hover {
    background: #c42f2f;
    /* slightly darker */
    border-color: #c42f2f;
}

@media (max-width: 576px) {
    #materialMenu {
        gap: .4rem;
    }

    #materialMenu .nav-link {
        padding: .45rem .9rem;
        font-size: .95rem;
    }
}

/* Back-to-Top Button */
#backToTopBtn.back-to-top {
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: #DD3635;
    /* brand red */
    color: #fff;
    border: none;
    box-shadow: 0 .5rem 1.25rem rgba(0, 0, 0, .2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: opacity .2s ease, transform .2s ease, visibility 0s linear .2s;
    z-index: 4050;
    /* above dev-footer (4000) */
}

#backToTopBtn.back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition: opacity .2s ease, transform .2s ease;
}

#backToTopBtn.back-to-top:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(221, 54, 53, .35);
}

#backToTopBtn .mdi {
    font-size: 20px;
    line-height: 1;
}

.video-card {
    position: relative;
    background: transparent;
    border-radius: 0.75rem;
    padding: 0;
    /* text sits below image without inner padding */
    cursor: pointer;
    /* full card clickable */
}

.video-thumb {
    display: block;
    border-radius: 0.75rem;
    overflow: hidden;
    position: relative;
    aspect-ratio: 16 / 9;
    /* force identical size for all thumbs */
    background: #fff;
    /* white canvas behind images */
    box-shadow: 0 .35rem .9rem rgba(0, 0, 0, .12);
    /* shadow only under image */
    transition: transform .12s ease, box-shadow .12s ease;
}

.video-thumb-img {
    width: 100%;
    height: 100%;
    /* fill container height */
    object-fit: cover;
    /* crop to container while preserving aspect */
    display: block;
}

.video-title {
    margin: 1.2rem 0;
    font-weight: 600;
    color: #212529;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.video-card span {
    position: absolute;
    bottom: 3px;
    right: 3px;
    background-color: #212529;
    color: white;
    border-radius: 20px;
    padding: 0px 10px;
    font-size: 12px;
}

/* --- Portal Material: Mindfulness (Achtsamkeit) --- */
.mindfulness-list {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: space-evenly;
}

.btn-mindfulness {
    --mindfulness-bg: #BEC531;
    /* matches provided sample color */
    background-color: var(--mindfulness-bg) !important;
    color: #1f2937 !important;
    /* slate-800 for contrast */
    font-weight: 600;
    border: none;
    border-radius: .5rem;
    padding: .6rem 1rem;
    box-shadow: 0 .25rem .6rem rgba(0, 0, 0, .08);
    transition: transform .06s ease, box-shadow .12s ease, filter .12s ease;
}

.btn-mindfulness:hover,
.btn-mindfulness:focus {
    filter: brightness(0.95);
    box-shadow: 0 .35rem 1rem rgba(0, 0, 0, .12);
}

.btn-mindfulness:active {
    transform: translateY(1px);
}

.audio-player {
    width: 100% !important;
    filter: drop-shadow(0px 0px 4px rgba(0, 0, 0, 0.3));
}