/* Global Mobile Responsive Styles */

/* Base mobile adjustments */
@media (max-width: 768px) {
    body {
        padding: 12px !important;
        padding-top: 88px !important;
    }

    /* Container adjustments */
    .container, .content-wrapper {
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    /* Card/Panel adjustments */
    .card, .panel, .box {
        padding: 16px !important;
        border-radius: 12px !important;
        margin-bottom: 12px !important;
    }

    /* Typography */
    h1 {
        font-size: 1.5rem !important;
    }

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

    h3 {
        font-size: 1.1rem !important;
    }

    p, li, span {
        font-size: 0.9rem !important;
        line-height: 1.5 !important;
    }

    /* Form elements - Touch friendly */
    input[type="text"],
    input[type="email"],
    input[type="password"],
    input[type="number"],
    input[type="tel"],
    input[type="url"],
    input[type="date"],
    input[type="time"],
    textarea,
    select {
        font-size: 16px !important; /* Prevents iOS zoom */
        min-height: 44px !important;
        padding: 12px 14px !important;
    }

    /* Buttons - Touch friendly */
    button, .btn, a.button {
        min-height: 44px !important;
        padding: 12px 20px !important;
        font-size: 0.95rem !important;
        width: auto !important;
    }

    /* Tables - Horizontal scroll */
    .table-responsive, .table-wrapper {
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        margin: 0 -12px !important;
        padding: 0 12px !important;
    }

    table {
        font-size: 0.85rem !important;
        min-width: 600px !important;
    }

    table th, table td {
        padding: 8px 6px !important;
        white-space: nowrap !important;
    }

    /* Grid layouts */
    .grid, .row {
        grid-template-columns: 1fr !important;
        flex-direction: column !important;
        gap: 12px !important;
    }

    /* Modal/Dialog */
    .modal, .dialog {
        width: calc(100% - 24px) !important;
        margin: 12px !important;
        max-height: calc(100vh - 24px) !important;
    }

    /* Navigation menus */
    .nav-menu, .menu {
        flex-direction: column !important;
        gap: 8px !important;
    }

    /* Images */
    img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* Hide desktop-only elements */
    .desktop-only {
        display: none !important;
    }

    /* Show mobile-only elements */
    .mobile-only {
        display: block !important;
    }

    /* Improve touch targets */
    a, button, input, select, textarea {
        -webkit-tap-highlight-color: rgba(0, 204, 255, 0.2);
    }

    /* Better spacing for lists */
    ul, ol {
        padding-left: 20px !important;
    }

    li {
        margin-bottom: 8px !important;
    }

    /* Flexbox adjustments */
    .flex-row {
        flex-direction: column !important;
    }

    .flex-between {
        justify-content: flex-start !important;
        gap: 12px !important;
    }
}

/* Extra small devices */
@media (max-width: 480px) {
    body {
        padding: 8px !important;
        padding-top: 84px !important;
    }

    .card, .panel, .box {
        padding: 12px !important;
    }

    h1 {
        font-size: 1.3rem !important;
    }

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

    table {
        font-size: 0.75rem !important;
    }

    table th, table td {
        padding: 6px 4px !important;
    }

    button, .btn, a.button {
        padding: 10px 16px !important;
        font-size: 0.9rem !important;
    }
}

/* Landscape mobile orientation */
@media (max-width: 768px) and (orientation: landscape) {
    body {
        padding-top: 70px !important;
    }

    .top, .topbar {
        height: 50px !important;
        min-height: 50px !important;
    }
}

/* iOS safe area support */
@supports (padding: max(0px)) {
    body {
        padding-left: max(12px, env(safe-area-inset-left)) !important;
        padding-right: max(12px, env(safe-area-inset-right)) !important;
        padding-bottom: max(12px, env(safe-area-inset-bottom)) !important;
    }
}

/* Touch feedback */
@media (hover: none) and (pointer: coarse) {
    button:active, .btn:active, a:active {
        transform: scale(0.98);
        opacity: 0.9;
    }

    select:active, input:active, textarea:active {
        border-color: #00ccff !important;
        box-shadow: 0 0 0 3px rgba(0, 204, 255, 0.1) !important;
    }
}

/* Hide timezone on mobile */
@media (max-width: 768px) {
    .desktop-only-tz {
        display: none !important;
    }
}

/* Prevent text size adjustment on orientation change */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

/* Improve scrolling */
body {
    -webkit-overflow-scrolling: touch;
    overflow-x: hidden;
}

/* Select dropdown improvements for mobile */
@media (max-width: 768px) {
    select {
        appearance: none;
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23a9b0bd' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
        background-repeat: no-repeat;
        background-position: right 12px center;
        padding-right: 36px !important;
    }
}
