/* Mobile Responsiveness Fixes */
/* Ensures proper touch targets and mobile-friendly layouts */

/* ===================================
   1. BUTTON TOUCH TARGETS (44x44px minimum)
   =================================== */

/* Back and Profile buttons */
.btn-secondary,
.btn-main {
    min-height: 44px;
    min-width: 44px;
    padding: 10px 16px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

/* Mobile: Icon-only buttons on very small screens */
@media (max-width: 380px) {
    .btn-secondary span,
    .btn-main:not(#connectBtn) span {
        display: none;
    }

    .btn-secondary,
    .btn-main:not(#connectBtn) {
        padding: 12px;
        min-width: 44px;
    }

    .avatar-dropdown-menu .btn-main span,
    #connectBtn span {
        display: inline !important;
    }
}

/* ===================================
   2. AUDIO PLAYER RESPONSIVENESS
   =================================== */

/* Make audio players responsive */
audio {
    width: 100%;
    max-width: 300px;
    height: 40px;
    min-height: 40px;
}

@media (max-width: 640px) {
    audio {
        max-width: 100%;
        width: 100%;
    }
}

/* ===================================
   3. TEXT READABILITY
   =================================== */

/* Ensure minimum font sizes on mobile */
@media (max-width: 640px) {
    body {
        font-size: 16px; /* Prevents iOS zoom on input focus */
    }

    p, span, div {
        font-size: 14px;
        line-height: 1.5;
    }

    h1 {
        font-size: 28px;
        line-height: 1.2;
    }

    h2 {
        font-size: 24px;
        line-height: 1.3;
    }

    h3 {
        font-size: 20px;
        line-height: 1.4;
    }

    /* Ensure readable text in cards */
    .card p,
    .card span {
        font-size: 14px;
    }
}

/* ===================================
   4. SPACING ADJUSTMENTS
   =================================== */

/* Better spacing on very small screens */
@media (max-width: 380px) {
    .container {
        padding-left: 12px;
        padding-right: 12px;
    }

    /* Reduce gap in flex containers */
    .flex {
        gap: 8px;
    }
}

/* ===================================
   5. PREVENT HORIZONTAL SCROLL
   =================================== */

/* Keep media responsive without constraining interactive or positioned UI. */
img,
video,
canvas,
svg {
    max-width: 100%;
}

img,
video {
    height: auto;
}

/* ===================================
   6. FORM INPUTS
   =================================== */

/* Mobile-friendly form inputs */
@media (max-width: 640px) {
    input[type="text"],
    input[type="email"],
    input[type="number"],
    textarea {
        font-size: 16px; /* Prevents iOS zoom */
        min-height: 44px;
        padding: 12px;
    }

    button[type="submit"] {
        min-height: 48px;
        font-size: 16px;
        padding: 12px 24px;
    }
}

/* ===================================
   7. NAVIGATION IMPROVEMENTS
   =================================== */

/* Keep dropdowns outside the sticky header from becoming header scroll areas. */
header {
    overflow: visible;
}

header .container {
    overflow-x: visible;
}

/* Better mobile menu */
@media (max-width: 640px) {
    header > .container > .flex {
        display: grid !important;
        grid-template-columns: auto minmax(0, 1fr) auto;
        grid-template-areas:
            "logo . actions"
            "context context context";
        align-items: center !important;
        flex-wrap: nowrap !important;
        gap: 0.5rem 0.75rem !important;
    }

    header > .container > .flex > :first-child {
        grid-area: logo;
    }

    header > .container > .flex > :nth-child(2) {
        grid-area: context;
        justify-self: center;
        width: 100%;
        text-align: center;
    }

    header > .container > .flex > :last-child {
        grid-area: actions;
        justify-self: end;
    }
}

/* ===================================
   8. CARD LAYOUTS
   =================================== */

/* Responsive card grids */
@media (max-width: 640px) {
    .grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card {
        margin-bottom: 16px;
    }
}

@media (min-width: 641px) and (max-width: 1024px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* ===================================
   9. MODAL/OVERLAY FIXES
   =================================== */

/* Ensure modals are mobile-friendly */
@media (max-width: 640px) {
    .modal,
    [role="dialog"] {
        width: 95%;
        max-width: 95%;
        margin: 10px;
        max-height: 90vh;
        overflow-y: auto;
    }
}

/* ===================================
   10. TOUCH-FRIENDLY INTERACTIONS
   =================================== */

/* Larger tap targets for content links without changing header logo geometry. */
main a:not(.logo-link),
footer a:not(.logo-link),
.section a:not(.logo-link),
.modal a:not(.logo-link) {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}

/* Remove hover effects on touch devices */
@media (hover: none) {
    .hover\:scale-105:hover {
        transform: none;
    }
}
