/* Merchant Empires Responsive CSS */
/* Mobile-friendly styles for tables and layout */

/* Base responsive styles */
* {
    box-sizing: border-box;
}

/* Fix left sidebar positioning */
.left-sidebar {
    position: sticky;
    left: 0;
    top: 0;
    z-index: 100;
}

/* Make tables responsive */
.responsive-table {
    max-width: 600px;
    width: 100%;
    margin: 0 auto;
}

/* Container for responsive content */
.responsive-container {
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
    padding: 0 10px;
}

/* Main layout adjustment */
@media screen and (max-width: 768px) {
    /* Hide sidebars and spacers on mobile */
    .left-sidebar, .right-sidebar, .desktop-spacer, .responsive-hide-mobile {
        display: none;
    }

    /* Full width main content */
    .main-content {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Responsive tables */
    table {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Adjust fixed-width elements */
    td[width="600"], td[width="590"], td[width="500"] {
        width: 100% !important;
    }

    /* Navigation controls responsive */
    .nav-container {
        scale: 0.9;
        margin: 0 auto;
    }

    /* Force dropdown responsive */
    .force-dropdown {
        max-width: 90vw;
        left: 5vw !important;
        right: 5vw !important;
        transform: none !important;
    }

    /* Sector grid responsive */
    .map-grid {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Action icons grid responsive */
    .action-icons-grid {
        gap: 10px;
    }

    .action-icon {
        width: 40px;
        height: 40px;
    }
}

/* Small mobile devices */
@media screen and (max-width: 480px) {
    /* Even smaller navigation */
    .nav-container {
        scale: 0.75;
    }

    /* Compact force buttons */
    .force-buttons {
        flex-wrap: wrap;
    }

    .force-btn {
        min-width: 45px;
        padding: 4px 8px;
        font-size: 11px;
    }

    /* Compact sector display */
    .sector {
        width: 90px !important;
        height: 90px !important;
    }

    .sector-id {
        font-size: 10px !important;
    }

    .goods-icon {
        width: 14px !important;
        height: 14px !important;
    }

    /* Stack table cells vertically */
    tr {
        display: flex;
        flex-direction: column;
        width: 100%;
    }

    td {
        width: 100% !important;
        display: block;
    }

    /* Navigation buttons */
    .nav-button {
        width: 35px !important;
        height: 35px !important;
        font-size: 10px !important;
    }
}

/* Ultra small devices */
@media screen and (max-width: 360px) {
    /* Minimal font sizes */
    body {
        font-size: 12px;
    }

    /* Compact headers */
    h1, h2, h3, h4, h5, h6 {
        font-size: 1.1em !important;
    }

    /* Minimal padding */
    td[cellpadding="5"] {
        padding: 2px !important;
    }
}

/* Merchant submenu styles */
.merchant-submenu {
    display: inline-block;
    padding: 8px 12px;
    font-family: arial, helvetica, sans-serif;
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    text-decoration: none;
    color: #cc0000;
    background-color: transparent;
    border: none;
    transition: all 0.2s ease;
}

.merchant-submenu:hover {
    color: #ff0000;
}

.merchant-submenu.active {
    color: #3333FF;
    border: 1px solid #3333FF;
    padding: 7px 11px; /* Adjust padding to account for border */
}

/* Utility classes for responsive behavior */
.mobile-only {
    display: none;
}

.desktop-only {
    display: block;
}

@media screen and (max-width: 768px) {
    .mobile-only {
        display: block;
    }

    .desktop-only {
        display: none;
    }
}

/* Scrollable containers */
.scrollable-x {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.scrollable-y {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: 80vh;
}

/* Touch-friendly buttons */
@media screen and (max-width: 768px) {
    a, button, input[type="submit"], input[type="button"] {
        min-height: 44px;
        min-width: 44px;
        padding: 10px;
    }

    /* Game list button column on mobile - ensure consistent spacing */
    form[name^="play_game_"] a img,
    form[name^="join_game_"] a img {
        max-width: 100%;
        height: auto;
    }

    /* Ensure form buttons have proper spacing on mobile */
    form[name^="play_game_"] a,
    form[name^="join_game_"] a,
    form[name^="notify_game_"] a {
        margin: 4px 0;
        touch-action: manipulation;
    }

    /* Responsive button class - mobile touch targets with vertical centering */
    .responsive-button {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center;
        justify-content: center;
    }
}