/* ============================================
   Responsive Design for Clip Admin Portal
   Handles small screens, tablets, and high zoom levels (up to 150%)
   ============================================ */

/* Base responsive utilities */
.responsive-container {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
}

/* Responsive tables and grids */
.responsive-table-wrapper {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1rem;
}

.responsive-table-wrapper table {
    min-width: 600px; /* Minimum width before horizontal scroll */
}

/* Card responsiveness */
.card {
    margin-bottom: 1rem;
}

.card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
}

.card-header .button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

/* Button responsiveness */
.button-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.btn {
    white-space: nowrap;
    min-width: auto;
}

/* Form responsiveness */
.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1rem;
}

.form-group {
    flex: 1 1 auto;
    min-width: 200px;
}

/* Responsive spacing utilities */
.responsive-padding {
    padding: clamp(0.5rem, 2vw, 1rem);
}

.responsive-margin {
    margin: clamp(0.5rem, 2vw, 1rem);
}

/* ============================================
   Media Queries for Different Screen Sizes
   ============================================ */

/* Large tablets and small desktops (1024px and below) */
@media (max-width: 1024px) {
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }

    .card-header h3 {
        font-size: 1.25rem;
    }

    .btn {
        font-size: 0.875rem;
        padding: 0.375rem 0.75rem;
    }

    /* Stack buttons vertically on smaller screens */
    .card-header .button-group {
        flex-direction: column;
        width: 100%;
    }

    .card-header .button-group .btn {
        width: 100%;
    }
}

/* Tablets (768px and below) - This also handles 150% zoom on 1280px screens */
@media (max-width: 768px) {
    .card-header {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .card-header h3 {
        font-size: 1.1rem;
        margin-bottom: 0.5rem;
    }

    /* Compact grid columns */

    /* Reduce form field widths */
    .form-group {
        min-width: 100%;
        flex: 1 1 100%;
    }

    /* Alert messages */
    .alert {
        font-size: 0.875rem;
        padding: 0.5rem;
    }

    /* Modal dialogs */
    .modal-dialog {
        margin: 0.5rem;
        max-width: calc(100% - 1rem);
    }
}

/* Mobile phones (576px and below) */
@media (max-width: 576px) {
    .card {
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .card-header h3 {
        font-size: 1rem;
    }

    .btn {
        font-size: 0.813rem;
        padding: 0.25rem 0.5rem;
    }

    /* Stack all form elements */
    .form-row {
        flex-direction: column;
    }

    /* Reduce padding everywhere */
    .card-body {
        padding: 0.5rem;
    }

    /* Make badges smaller */
    .badge {
        font-size: 0.7rem;
        padding: 0.2rem 0.4rem;
    }
}

/* ============================================
   High DPI / Zoom Level Adjustments
   Specifically for 150% zoom on standard screens
   ============================================ */
@media (min-resolution: 144dpi) and (max-width: 1366px),
       (-webkit-min-device-pixel-ratio: 1.5) and (max-width: 1366px) {

    /* Reduce font sizes slightly at high zoom */
    body {
        font-size: 14px;
    }

    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    h5 { font-size: 1rem; }

    /* Compact spacing */
    .container-fluid {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .card-body {
        padding: 0.75rem;
    }

    /* Reduce button sizes */
    .btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.875rem;
    }

    /* Make toolbar items wrap */
    
}

/* ============================================
   Specific fixes for common admin scenarios
   ============================================ */

/* Radio button groups - make them stack on small screens */
@media (max-width: 768px) {
    .radio-group-container {
        flex-direction: column;
    }

    .radio-group {
        flex-direction: column;
        align-items: flex-start;
    }

    .radio-label {
        margin-bottom: 0.5rem;
        width: 100%;
    }
}

/* Status badges - ensure they don't overflow */
.status-badges-compact {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.badge-mini {
    font-size: 0.7rem;
    padding: 0.2rem 0.4rem;
    white-space: nowrap;
}

/* Class cards - make them responsive */
.class-card-compact {
    display: flex;
    gap: 0.5rem;
    padding: 0.5rem;
    flex-wrap: wrap;
}

@media (max-width: 576px) {
    .class-card-compact {
        flex-direction: column;
    }

    .drag-handle {
        display: none; /* Hide drag handle on very small screens */
    }
}

/* Print button - hide on very small screens if space is tight */
@media (max-width: 576px) {
    .btn-print-label {
        display: none;
    }

    .btn i.fa-print {
        margin-right: 0 !important;
    }
}

/* ============================================
   AdminHome - Dropdown selector bar and tabs responsive
   ============================================ */

/* Fix traffic lights overflow issue */
.ab-lights {
    overflow: visible !important;
    min-width: fit-content !important;
}

/* ============================================
   Mobile Content Visibility Fix
   On mobile, make sticky headers scroll away to show content
   ============================================ */

@media (max-width: 768px) {
    /* Make headers scroll away on mobile instead of sticky */
    .admin-bar,
    .tab-control {
        position: relative !important;
        top: auto !important;
    }

    /* Ensure content wrapper takes available space */
    .content-wrapper {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        min-height: 0 !important;
    }

    /* Ensure main content is visible and scrollable */
    .main-content {
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 10px !important;
        min-height: 300px !important;
    }

    /* Ensure control-container allows scrolling */
    .control-container {
        overflow-y: auto !important;
        overflow-x: hidden !important;
        height: auto !important;
        min-height: 100vh !important;
        max-height: none !important;
    }
}

/* Make dropdown selector bar wrap on mobile */
@media (max-width: 768px) {
    /* Selector bar - allow wrapping */
    .control-container > div:nth-child(2) {
        flex-wrap: wrap !important;
        gap: 10px !important;
        padding: 10px !important;
    }

    /* Individual dropdown containers */
    .control-container > div:nth-child(2) > div {
        flex: 1 1 100% !important;
        min-width: 100% !important;
    }

    /* Dropdowns full width on mobile */
    .control-container > div:nth-child(2) select {
        width: 100% !important;
        min-width: 100% !important;
    }

    /* Stats container */
    .control-container > div:nth-child(2) > div:last-child {
        margin-left: 0 !important;
        flex: 1 1 100% !important;
        text-align: center !important;
    }
}

/* Make tabs wrap on mobile */
@media (max-width: 768px) {
    .tab-control {
        flex-wrap: wrap !important;
        gap: 5px !important;
        padding: 8px !important;
    }

    .tab-button {
        flex: 1 1 calc(50% - 5px) !important;
        min-width: calc(50% - 5px) !important;
        max-width: calc(50% - 5px) !important;
        font-size: 0.813rem !important;
        padding: 8px 4px !important;
        text-align: center !important;
        /* One tab carries the selected class name - "Class (Junior
           Woolhandling Heats)" - far longer than half a phone screen.
           display:block is what makes text-overflow work: on a button the
           text sits in an anonymous flex box and ellipsis is ignored, so it
           clipped mid-word with no indication there was more. */
        display: block !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }
}

/* Small screens keep two per row rather than stacking.
   Stacking eight tabs one per row pushed the first line of actual content
   about 370px down a 390px-wide phone - the whole screen was navigation
   before anything useful. The labels are short enough to pair up. */
@media (max-width: 480px) {
    .tab-button {
        flex: 1 1 calc(50% - 5px) !important;
        min-width: calc(50% - 5px) !important;
        max-width: calc(50% - 5px) !important;
        font-size: 0.78rem !important;
        padding: 7px 4px !important;
    }
}

/* ============================================
   EditClass - Syncfusion Tab responsive (Class edit sub-tabs)
   ============================================ */

@media (max-width: 768px) {
}

/* Very small screens - make tabs even more compact */
@media (max-width: 576px) {
    
}

/* ============================================
   Utility classes for manual responsive control
   ============================================ */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

@media (max-width: 768px) {
    .hide-mobile {
        display: none !important;
    }

    .show-mobile {
        display: block !important;
    }
}

/* Responsive text sizing */
.text-responsive {
    font-size: clamp(0.875rem, 2vw, 1rem);
}

.heading-responsive {
    font-size: clamp(1.25rem, 3vw, 2rem);
}

/* Prevent horizontal overflow */
* {
    max-width: 100%;
}

table {
    max-width: 100%;
}

img {
    max-width: 100%;
    height: auto;
}.control-container table.table td,
.clip-dialog table.table td {
    color: var(--text-primary, #f5f0e8) !important;
}.control-container table.table th,
.clip-dialog table.table th {
    color: var(--text-primary, #f5f0e8) !important;
}.control-container tr.bg-white td {
    color: #212529 !important;
}.control-container .card label,
.control-container .card .form-label,
.control-container .form-label,
.control-container label,
.clip-dialog label,
.clip-dialog .form-label {
    color: var(--text-primary, #f5f0e8) !important;
}.control-container .card .nav-link {
    color: var(--text-primary, #f5f0e8) !important;
}.control-container .card .nav-link.active {
    color: #fff !important;
    background: var(--accent-gold, #b8965a) !important;
}
/* Form control text — scoped */
.control-container .card .form-control-plaintext,
.control-container .card p,
.control-container .card span:not(.badge),
.control-container .card h5,
.control-container .card h6 {
    color: var(--text-primary, #f5f0e8) !important;
}

/* FIX 4: Results tab buttons — fix low contrast */
.btn-success {
    background-color: #15803d !important;
    border-color: #15803d !important;
}
.btn-warning {
    color: #000 !important;
}

/* FIX 6: Yellow/warning badges — use dark text */
.badge.bg-warning,
.badge-warning {
    color: #212529 !important;
}
.badge {
    min-font-size: 11px;
    font-size: max(11px, 0.7rem) !important;
}

/* FIX 7: Stand allocation labels */
.stand-header,
.heat-header {
    color: var(--text-primary, #f5f0e8) !important;
}

/* FIX 8: Button contrast fixes */
.btn-danger {
    background-color: #c62828 !important;
    border-color: #c62828 !important;
}h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: 'Bebas Neue', Impact, sans-serif;
}

/* FIX 10: Alert headings */
.alert-info h2,
.alert-info h3,
.alert h2,
.alert h3 {
    color: #055160 !important;
}
.alert-info p,
.alert-info {
    color: #055160 !important;
}.control-container .card-body,
.control-container .card-body *:not(.badge):not(.btn):not(.alert):not(.alert *),
.clip-dialog .card-body,
.clip-dialog .card-body *:not(.badge):not(.btn):not(.alert):not(.alert *) {
    color: var(--text-primary, #f5f0e8);
}.control-container .card-body input,
.control-container .card-body select,
.control-container .card-body textarea {
    color: #212529 !important;
}
