/* ===========================================
   GLOBAL RESPONSIVE — applies to every page
   =========================================== */

/* --- Base resets for mobile-safety --- */
*, *::before, *::after {
    box-sizing: border-box;
}

img, video, iframe, canvas, svg {
    max-width: 100%;
    height: auto;
}

/* Prevent horizontal overflow on any page */
body {
    overflow-x: hidden;
}

main,
main > section,
main > div {
    max-width: 100%;
}

/* --- HEADER fixes --- */
.site-header {
    backdrop-filter: blur(10px);
}

/* Logo stays properly sized on all screens */
.site-header .container {
    gap: 20px;
    min-height: 56px;
}

.site-logo {
    width: auto !important;
    height: 56px !important;
    max-width: min(240px, 42vw) !important;
    max-height: 56px !important;
    object-fit: contain;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .site-logo {
        height: 42px !important;
        max-height: 42px !important;
        max-width: 150px !important;
    }

    .site-header .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

@media (max-width: 1200px) {
    .site-header nav {
        margin-left: 0 !important;
        gap: 20px !important;
    }

    .footer-links {
        gap: 18px;
    }
}

/* --- FOOTER (base.html) --- */
.footer {
    padding: 24px 12px 0;
}

@media (max-width: 600px) {
    .container-footer,
    .footer > div {
        padding: 0 8px;
    }

    .eu-emblem {
        width: 100%;
        max-width: 100%;
        justify-content: center;
    }

    .partner-logos,
    .eu-emblem img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }

    .eu-disclaimer p {
        font-size: 15px !important;
        line-height: 1.85;
    }

    .footer-links {
        gap: 14px;
        flex-wrap: wrap;
        justify-content: center;
    }

    .footer-links a {
        font-size: 14px;
    }
}

/* --- MOBILE MENU improvements --- */
@media (max-width: 1024px) {
    [data-mobile-panel] > div {
        width: 94% !important;
        max-width: 400px;
    }
}

/* --- HOME page hero section --- */
#heroTypewriter {
    width: 100%;
    max-width: 100%;
}

.typewriter-container {
    max-width: 100%;
}

.typewriter-text,
.typewriter-ghost {
    max-width: 100%;
    overflow-wrap: break-word;
    word-break: break-word;
    white-space: normal;
}

#home-section,
#home-section .overflow-hidden,
#home-section .container,
#home-section .grid,
#home-section .lg\:col-span-7 {
    width: 100%;
    min-width: 0;
}

#home-section .lg\:col-span-7 {
    position: relative;
    z-index: 2;
}

#home-section h1,
#home-section .typewriter-container {
    min-width: 0;
}

@media (max-width: 768px) {
    #home-section .container {
        padding-top: 0 !important;
    }
}

@media (max-width: 480px) {
    #home-section .container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .hero-cta-row {
        flex-direction: column;
        align-items: stretch;
    }

    .hero-btn-primary,
    .hero-btn-secondary {
        justify-content: center;
        text-align: center;
        width: 100%;
    }

    #home-section h1 {
        margin-bottom: 20px !important;
    }
}

/* --- HOME work-section cards --- */
@media (max-width: 480px) {
    #work-section .grid {
        gap: 60px 0;
    }

    #work-section .bg-workcard {
        padding: 16px 14px 14px !important;
        padding-top: 50px !important;
    }

    #work-section .icon-circle {
        width: 64px;
        height: 64px;
        top: -32px;
    }

    #work-section .icon-circle img {
        width: 32px;
        height: 32px;
    }
}

/* --- HOME trade section --- */
@media (max-width: 480px) {
    #trade-section h2.sm\:text-5xl {
        font-size: 1.6rem !important;
    }

    #trade-section .flex.gap-4 {
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        flex-wrap: nowrap;
        gap: 10px;
    }

    #trade-section .flex.gap-4 img {
        max-width: calc(50% - 5px);
        height: 36px !important;
        width: auto;
        object-fit: contain;
    }

    #trade-section img[alt="trade"] {
        width: 90%;
        margin: 0 auto;
        display: block;
    }
}

/* --- HOME FAQ section --- */
@media (max-width: 640px) {
    #faq-section {
        padding: 40px 0 !important;
    }

    #faq-section .max-w-7xl {
        padding: 0 14px !important;
    }

    #faq-section h2 {
        font-size: 1.8rem !important;
        margin-bottom: 16px !important;
    }

    #faq-section .flex.flex-col.lg\:flex-row {
        flex-direction: column !important;
        gap: 24px !important;
        align-items: stretch !important;
    }

    #faq-section .w-full.lg\:w-3\/5 {
        width: 100% !important;
    }

    #faq-section .w-full.lg\:w-2\/5 {
        width: 100% !important;
        display: flex;
        justify-content: center;
    }

    #faq-section .w-full.lg\:w-2\/5 img {
        max-width: 260px;
        transform: none !important;
    }

    .faq-card {
        padding: 18px 16px !important;
        border-radius: 16px !important;
    }

    .faq-card button span:first-child {
        font-size: 1rem !important;
    }

    .faq-card [data-faq-panel] div p,
    .faq-card [data-faq-panel] div div {
        font-size: 0.95rem !important;
    }
}

/* --- COURSE page (course.html) --- */
@media (max-width: 480px) {
    .back-button {
        top: 12px !important;
        left: 12px !important;
        padding: 8px 14px !important;
        font-size: 0.8rem !important;
    }

    .course-header {
        padding: 2rem 0 2rem !important;
    }

    .completion-stats {
        gap: 1.5rem !important;
    }

    .stat-value {
        font-size: 1.5rem !important;
    }
}

/* --- ACCOUNT / ABOUT page --- */
@media (max-width: 360px) {
    .about-hero h1 {
        font-size: 22px !important;
    }

    .about-hero p {
        font-size: 13px !important;
    }

    .btn-primary-custom,
    .btn-outline-custom {
        min-width: 100% !important;
        height: 44px !important;
        font-size: 13px !important;
    }
}

/* --- VIDEO responsiveness on all pages --- */
video {
    max-width: 100%;
    display: block;
}

.course-video-player {
    width: 100% !important;
    height: auto !important;
    max-width: 100% !important;
}

/* --- PDF canvas responsive --- */
.pdf-canvas {
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* --- Logout modal — mobile --- */
@media (max-width: 480px) {
    .logout-modal-card {
        padding: 28px 20px 24px !important;
        width: 95% !important;
        border-radius: 18px !important;
    }

    .logout-modal-title {
        font-size: 17px !important;
    }

    .logout-modal-subtitle {
        font-size: 13px !important;
    }

    .btn-cancel,
    .btn-confirm-logout {
        padding: 10px !important;
        font-size: 14px !important;
        border-radius: 10px !important;
    }
}

/* --- User dropdown pill — mobile --- */
@media (max-width: 480px) {
    .auth-name {
        max-width: 90px !important;
        font-size: 12px !important;
    }

    .auth-avatar {
        width: 36px !important;
        height: 36px !important;
        font-size: 16px !important;
    }
}

