/* ═══════════════════════════════════════════════════
   AethyrTech Responsive Overrides
   Master responsive stylesheet for all pages
   ═══════════════════════════════════════════════════ */

/* ── GLOBAL ── */
html {
    overflow-x: hidden;
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

img,
video,
canvas,
svg {
    max-width: 100%;
    height: auto;
}

/* Ensure charts are responsive */
canvas {
    max-width: 100% !important;
}

/* ═══ SIDEBAR MOBILE OVERLAY ═══ */
#sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 29;
    transition: opacity 0.3s ease;
}

#sidebar-overlay.active {
    display: block;
}

/* Sidebar close button (mobile only) */
.sidebar-close-btn {
    display: none;
}

@media (max-width: 767px) {
    .sidebar-close-btn {
        display: flex;
    }

    /* Sidebar when open on mobile */
    #sidebar.sidebar-open {
        transform: translateX(0) !important;
    }
}

/* ═══ DASHBOARD HEADER ═══ */
@media (max-width: 767px) {

    /* Truncate long header titles */
    header h1,
    header h2 {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 55vw;
    }
}

/* ═══ MODAL RESPONSIVE ═══ */
@media (max-width: 767px) {

    /* Reduce modal border-radius on small screens */
    [class*="rounded-[3rem]"] {
        border-radius: 1.5rem !important;
    }

    [class*="rounded-[2rem]"] {
        border-radius: 1rem !important;
    }

    [class*="rounded-[2.5rem]"] {
        border-radius: 1.25rem !important;
    }

    /* Modal padding reduction */
    .modal-body-padding {
        padding: 1.25rem !important;
    }

    /* Modal title size */
    div[id$="-modal"] h2 {
        font-size: 1.25rem !important;
    }
}

/* ═══ CARD / GRID RESPONSIVENESS ═══ */
@media (max-width: 767px) {

    /* Card padding reduction on mobile */
    .card-light[class*="p-10"] {
        padding: 1rem;
    }

    /* Mobile-friendly chart heights via data attribute */
    [data-mobile-chart] {
        height: 220px !important;
    }
}

/* ═══ CRO PAGE ═══ */
@media (max-width: 767px) {

    /* Chart container heights */
    [class*="h-[400px]"] {
        height: 260px !important;
    }

    [class*="h-[300px]"] {
        height: 200px !important;
    }

    [class*="h-[350px]"] {
        height: 220px !important;
    }

    [class*="h-[380px]"] {
        height: 250px !important;
    }

    [class*="h-[280px]"] {
        height: 200px !important;
    }

    [class*="h-[250px]"] {
        height: 180px !important;
    }

    [class*="h-[220px]"] {
        height: 180px !important;
    }
}

/* ═══ CATALOG TABLE ═══ */
@media (max-width: 767px) {
    .table-scroll-container {
        max-height: calc(100vh - 200px);
        border-radius: 1rem;
    }

    .catalog-table td,
    .catalog-table th {
        padding: 0.75rem 1rem;
        font-size: 0.7rem;
    }
}

/* ═══ REVIEWS INSIGHTS ═══ */
@media (max-width: 767px) {

    /* Word cloud */
    #wordCloudContainer {
        height: 220px !important;
    }

    /* KPI cards */
    .kpi-card {
        padding: 14px;
    }

    .kpi-card .text-3xl {
        font-size: 1.5rem;
    }

    /* Range slider labels */
    .range-labels {
        font-size: 9px;
    }
}

/* ═══ TACTICAL ACTION PLAN ═══ */
@media (max-width: 767px) {

    /* Tactical plan section */
    [class*="from-slate-900"][class*="p-8"] {
        padding: 1.25rem !important;
    }
}

/* ═══ PORTAL LOGIN PAGE ═══ */
@media (max-width: 767px) {

    /* Login form inputs */
    .login-input {
        width: 140px;
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
}

@media (max-width: 480px) {

    /* Very small screens: stack login form */
    form#login-form {
        flex-direction: column;
        gap: 0.5rem;
        align-items: stretch;
    }

    form#login-form .login-input {
        width: 100%;
    }

    form#login-form .login-button {
        width: 100%;
    }
}

/* ═══ WEBSITE PAGES (Public) ═══ */

/* Hero section */
@media (max-width: 767px) {
    #hero-carousel {
        min-height: 450px;
    }

    #hero-carousel h1 {
        font-size: 1.75rem;
        line-height: 1.2;
    }

    #hero-carousel p {
        font-size: 0.95rem;
    }

    #hero-carousel br {
        display: none;
    }
}

/* Logo marquee on small screens */
@media (max-width: 640px) {
    .logo-marquee span {
        font-size: 0.875rem;
    }
}

/* ═══ PLATFORM PAGE ═══ */
@media (max-width: 767px) {
    section h2[class*="text-4xl"] {
        font-size: 1.5rem;
    }
}

/* ═══ AUDIT / REPORTS PAGES ═══ */
@media (max-width: 767px) {

    /* Table overflow handling */
    .table-wrapper {
        border-radius: 0.75rem;
    }

    .tree-table th,
    .tree-table td {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

/* ═══ USER PROFILE DROPDOWN ═══ */
@media (max-width: 767px) {

    /* Ensure user profile dropdown is visible */
    .relative .absolute.right-0 {
        right: 0;
        left: auto;
        min-width: 200px;
    }
}

/* ═══ GENERAL UTILITY FIXES ═══ */

/* Fix for absolute decorative icons that may cause overflow on mobile */
@media (max-width: 767px) {
    i.absolute {
        display: none;
    }
}

/* Touch-friendly tap targets */
@media (max-width: 767px) {

    a,
    button {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
    }

    /* Exception for inline text links */
    p a,
    span a,
    td a,
    li a,
    nav a {
        min-height: auto;
        display: inline;
    }

    /* Exception for specific small badges/pills */
    .owner-badge,
    .status-pill,
    .score-pill,
    .carousel-dot {
        min-height: auto;
        display: inline-flex;
    }

    /* Keep sidebar links as flex (they need it for alignment) */
    #sidebar a {
        min-height: 44px;
        display: flex;
    }
}