/* Responsive Styles for the Theme */

@media (min-width: 768px) {
    .border-md-start {
        border-left: 1px solid #e5e7eb !important;
    }
}

@media (max-width: 767.98px) {
    /* DataTable Top Section Responsiveness */
    .dt--top-section .row > div {
        justify-content: center !important;
        margin-bottom: 1rem;
    }
    .dt--top-section .search-input {
        width: 100% !important;
    }
    
    /* General Card Body Padding for Mobile */
    .card-body {
        padding: 1rem !important;
    }

    /* Filters Section Responsiveness */
    .row.g-3 > .col-12 {
        margin-bottom: 0.5rem;
    }
    .ts-wrapper, .form-control {
        width: 100% !important;
    }

    /* Responsive Table for Repeater */
    .table-repeater-responsive {
        border: none !important;
    }

    .table-repeater-responsive thead {
        display: none !important;
    }

    .table-repeater-responsive tbody,
    .table-repeater-responsive tr,
    .table-repeater-responsive td {
        display: block !important;
        width: 100% !important;
    }

    .table-repeater-responsive tr {
        margin-top: 15px !important;
        border: 1px solid #e3e6f0 !important;
        padding: 2px 8px !important;
        border-radius: 12px !important;
        background: #fff !important;
        box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
        display: flex !important;
        flex-wrap: wrap !important;
    }

    .table-repeater-responsive td {
        padding: 8px 0 !important;
        border: none !important;
    }

    .table-repeater-responsive td:before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        font-size: 0.7rem;
        text-transform: uppercase;
        color: #888;
        margin-bottom: 2px;
        letter-spacing: 0.5px;
    }

    /* Hide label for Action or when data-label is empty */
    .table-repeater-responsive td[data-label="Action"]:before,
    .table-repeater-responsive td[data-label=""]:before {
        display: none !important;
    }

    /* Item: Row 1 */
    .table-repeater-responsive td:nth-child(1) {
        order: 1 !important;
        width: 100% !important;
        border-bottom: 1px solid #f8f9fc !important;
    }

    /* Qty: Row 2 Left */
    .table-repeater-responsive td:nth-child(2) {
        order: 2 !important;
        width: 50% !important;
        padding-right: 10px !important;
        padding-top: 0px !important;
    }

    /* Unit: Row 2 Right */
    .table-repeater-responsive td:nth-child(3) {
        order: 3 !important;
        width: 50% !important;
        padding-top: 0px !important;
    }

    /* Remark: Row 3 Left */
    .table-repeater-responsive td:nth-child(4) {
        order: 4 !important;
        width: 80% !important;
        border-top: 1px solid #f8f9fc !important;
        padding-top: 0px !important;
    }

    /* Action: Row 3 Right */
    .table-repeater-responsive td:nth-child(5) {
        order: 5 !important;
        width: 20% !important;
        border-top: 1px solid #f8f9fc !important;
        display: flex !important;
        align-items: center;
        justify-content: flex-end;
        padding-top: 0px !important;
    }
    /* Purchase Order Specific Repeater (6 columns) */
    .table-repeater-po tr {
        position: relative !important;
        padding-top: 40px !important; /* Space for absolute delete button */
    }

    .table-repeater-po td:nth-child(1) { order: 1; width: 100% !important; border-bottom: 1px solid #f8f9fc !important; }
    .table-repeater-po td:nth-child(2) { order: 2; width: 50% !important; }
    .table-repeater-po td:nth-child(3) { order: 3; width: 50% !important; }
    .table-repeater-po td:nth-child(4) { order: 4; width: 50% !important; border-top: 1px solid #f8f9fc !important; }
    .table-repeater-po td:nth-child(5) { order: 5; width: 50% !important; border-top: 1px solid #f8f9fc !important; }
    
    .table-repeater-po td:nth-child(6) { 
        position: absolute !important;
        top: 5px !important;
        right: 5px !important;
        width: auto !important;
        padding: 0 !important;
        border: none !important;
        background: transparent !important;
        z-index: 10;
    }

    .table-repeater-po td:nth-child(6) .btn {
        padding: 8px !important;
        border-radius: 8px !important;
        box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
    }

    /* GRN Specific Repeater (5 columns) */
    .table-repeater-grn td:nth-child(1) { order: 1; width: 100% !important; border-bottom: 1px solid #f8f9fc !important; }
    .table-repeater-grn td:nth-child(2) { order: 2; width: 50% !important; }
    .table-repeater-grn td:nth-child(3) { order: 3; width: 50% !important; }
    .table-repeater-grn td:nth-child(4) { 
        order: 4 !important; 
        width: 100% !important; 
        border-top: 1px solid #f8f9fc !important;
        padding-top: 5px !important;
    }
    .table-repeater-grn td:nth-child(5) { 
        order: 5 !important; 
        width: 100% !important; 
        padding-top: 0px !important;
    }

    /* Header & Breadcrumb Adjustments (Mobile Only) */
    .page-header .page-block .row > div.d-flex {
        flex-direction: column !important;
        align-items: center !important;
        gap: 8px;
    }

    .page-header .breadcrumb {
        justify-content: center !important;
        margin-bottom: 5px !important;
    }

    /* Target primary action buttons on index pages specifically if needed, 
       but for now let's just ensure they don't break desktop. */
}
