/* ==========================================
   SIMPLIFIED RESPONSIVE SYSTEM
   - Desktop: ≥992px (lg breakpoint)
   - Mobile/Tablet: <992px (unified view)
========================================== */

/* Desktop Layout (≥992px) */
@media (min-width: 992px) {
    main {
        margin-left: 250px;
    }
    
    /* Smaller margins for narrow desktop screens */
    main > div {
        margin-left: 1.5rem !important;
        margin-right: 1.5rem !important;
    }
}

/* Wide Desktop - more breathing room (≥1400px) */
@media (min-width: 1400px) {
    main > div {
        margin-left: 4rem !important;
        margin-right: 4rem !important;
    }
}

/* Improve 3-column layouts on narrow desktop (992px-1299px) */
@media (min-width: 992px) and (max-width: 1299px) {
    /* Force 3-column (col-lg-4) layouts to be 2 columns on narrow desktop */
    .col-lg-4 {
        flex: 0 0 auto;
        width: 50%; /* 2 columns instead of 3 */
    }
    
    /* Song Requests: Stack player and queue vertically on narrow desktop */
    #player-queue-row .col-lg-8,
    #player-queue-row .col-lg-4 {
        width: 100% !important;
        max-width: 100% !important;
    }
    
    /* Reduce card padding on narrow desktop */
    .card-body {
        padding: 0.875rem !important;
    }
    
    .card-header,
    .card-footer {
        padding: 0.625rem 0.875rem !important;
    }
    
    /* Reduce gap between cards */
    .row.g-3 {
        --bs-gutter-x: 0.75rem;
        --bs-gutter-y: 0.75rem;
    }
    
    /* Slightly smaller text in cards */
    .card h6 {
        font-size: 0.9rem !important;
    }
    
    .card .small {
        font-size: 0.775rem !important;
    }
    
    /* Smaller buttons in card footers */
    .card-footer .btn-panel {
        width: 36px;
        height: 36px;
        font-size: 0.9rem;
    }
    
    /* Reduce panel icon size */
    .panel-icon {
        width: 36px !important;
        height: 36px !important;
        font-size: 0.9rem !important;
    }
}

/* Commands table responsive fixes for narrow desktop (992px-1199px) */
@media (min-width: 992px) and (max-width: 1199px) {
    /* Hide Alias and User Level columns to prevent content escape */
    .command-row > div[style*="flex: 0 0 120px"]:nth-child(3),
    .command-row > div[style*="flex: 0 0 100px"]:nth-child(5) {
        display: none !important;
    }
    
    .card-header > div[style*="flex: 0 0 120px"]:nth-child(3),
    .card-header > div[style*="flex: 0 0 100px"]:nth-child(5) {
        display: none !important;
    }
    
    /* Adjust remaining column widths for better spacing */
    .command-row > div[style*="flex: 0 0 80px"] {
        flex: 0 0 70px !important;
    }
    
    .command-row > div[style*="flex: 0 0 120px"]:nth-child(2),
    .card-header > div[style*="flex: 0 0 120px"]:nth-child(2) {
        flex: 0 0 100px !important;
    }
    
    .command-row > div[style*="flex: 0 0 100px"]:last-child,
    .card-header > div[style*="flex: 0 0 100px"]:last-child {
        flex: 0 0 90px !important;
    }
    
    /* Make response column wrap text properly */
    .command-row .flex-grow-1 {
        min-width: 0; /* Allow flex item to shrink below content size */
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
    
    .command-row .flex-grow-1 small {
        font-size: 0.8rem;
        line-height: 1.3;
    }
}

/* Mobile/Tablet Unified Layout (<992px) */
@media (max-width: 991px) {
    main {
        padding-top: 60px;
    }
    
    main > div {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
    
    /* Mobile navbar */
    .navbar .container-fluid {
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
    
    /* Compact elements on smaller screens */
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    
    /* Cards */
    .card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    /* Tables - enable horizontal scroll */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        font-size: 0.9rem;
        min-width: 600px; /* Prevent crushing */
    }
    
    /* Buttons */
    .btn {
        padding: 8px 1rem;
        font-size: 0.9rem;
    }
    
    /* Forms */
    .form-control,
    .form-select {
        font-size: 16px; /* Prevents iOS zoom */
    }
    
    /* Navigation tabs - horizontal scroll */
    .nav-underline {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    
    .nav-underline::-webkit-scrollbar {
        display: none;
    }
    
    /* Stack columns on mobile */
    .row.g-3 {
        gap: 0.75rem !important;
    }
}

/* Mobile Menu Toggle Button */
.mobile-menu-toggle {
    background: transparent;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-toggle:hover,
.mobile-menu-toggle:focus,
.mobile-menu-toggle:active {
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
}