/* Responsive CSS for sngo.com.tw */

/* Global reset and basic responsiveness */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

/* Base layout adjustments */
body {
    margin: 0;
    padding: 0;
    width: 100%;
    overflow-x: hidden;
    text-align: left !important; /* Override text-align:center in gogoshop.css */
}

/* Main container table responsiveness */
table {
    max-width: 100%;
    width: 100% !important;
}

/* Force tables with fixed widths to be fluid */
table[width="900"], 
table[width="150%"], 
table[width="110%"],
table[width="600"] {
    width: 100% !important;
    margin: 0 auto;
}

/* Handle nested layout tables */
.main-layout-table {
    display: table;
    width: 100% !important;
}

.layout-row {
    display: table-row;
}

.sidebar {
    width: 202px;
    display: table-cell;
}

.content-area {
    display: table-cell;
    width: auto;
}

/* Responsive navigation menu */
.out, .over {
    width: 100% !important;
    max-width: 202px;
    background-size: contain !important;
}

/* Table scrolling for data tables (like calendars) */
.table-responsive, 
.calendar-container {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

/* Ensure images don't break layout */
td img {
    max-width: 100%;
    height: auto;
}

/* Mobile adjustments */
@media screen and (max-width: 768px) {
    /* General table adjustments for mobile */
    table, thead, tbody, th, td, tr {
        display: block;
        width: 100% !important;
    }

    /* Except for specific data tables that should remain tables but scroll */
    .calendar-table, 
    .calendar-table thead, 
    .calendar-table tbody, 
    .calendar-table th, 
    .calendar-table td, 
    .calendar-table tr {
        display: table !important;
        width: auto !important;
    }
    
    .calendar-table tr {
        display: table-row !important;
    }
    
    .calendar-table td {
        display: table-cell !important;
    }

    .main-layout-table, 
    .layout-row, 
    .sidebar, 
    .content-area {
        display: block !important;
        width: 100% !important;
    }

    .sidebar {
        background-repeat: repeat-x !important;
        height: auto !important;
    }

    /* Top banner adjustments */
    #Table_01 tr {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    #Table_01 td {
        width: 25% !important; /* 4 images per row on mobile */
    }

    /* Navigation menu */
    .sidebar {
        width: 100% !important;
    }
    
    .out, .over {
        max-width: 100%;
        text-align: center !important;
        padding: 0 !important;
    }

    /* Calendar specific adjustments */
    .calendar-table td {
        font-size: 11px;
        padding: 2px;
    }
}

@media screen and (max-width: 480px) {
    #Table_01 td {
        width: 50% !important; /* 2 images per row on very small screens */
    }
}
