/* ============================================================
   EPAK / KEAV — Responsive Styles
   Mobile  : max-width 767px
   Tablet  : 768px – 991px
   Desktop : 992px+
   ============================================================ */

/* 1. PAGE CONTAINER */
@media (max-width: 991px) {
    .page-container { padding: 16px 24px 10px 24px; }
}
@media (max-width: 767px) {
    body { padding-top: 10px; padding-bottom: 10px; }
    .page-container { padding: 12px 12px 10px 12px; box-shadow: none; }
    .container { overflow-x: hidden; }
}

/* 2. HEADER */
@media (max-width: 767px) {
    .logo img { max-width: 180px; height: auto; }
    .slogan { margin-top: 4px; margin-bottom: 4px; }
    .tmenu { margin-top: 0; text-align: right; }
    .tmenu .row { margin: 0; }
    .tmenu .col-md-6 { float: none !important; width: 100% !important; padding: 0; }
    .tmenu .greeting { display: block; font-size: 12px; margin-bottom: 2px; }
    ul.menu { display: flex; flex-wrap: nowrap; gap: 4px; justify-content: flex-end; margin: 0; }
    ul.menu li { float: none; padding-left: 0; }
    .tmenu a { float: none; display: inline-block; font-size: 12px; }
}
@media (min-width: 768px) and (max-width: 991px) {
    .tmenu { max-width: 100%; }
    ul.menu li { padding-left: 8px; }
}
@media (max-width: 991px) {
    select#company { width: 95%; max-width: 99%; box-sizing: border-box; display: block; margin-left: auto; margin-right: auto; }
}

/* 3. FOOTER */
footer ul.footer-links { display: none; }

@media (max-width: 767px) {
    /* Reset footer layout — clear all floats */
    footer {
        display: block !important;
        overflow: hidden;
        padding-bottom: 12px;
    }
    /* Hide all desktop floated items */
    footer p.float-left,
    footer p.float-right,
    footer div.float-right,
    footer .btn-seperator {
        display: none !important;
        float: none !important;
    }
    /* Copyright line — show it */
    footer p.float-left {
        display: block !important;
        float: none !important;
        font-size: 12px;
        color: #777;
        margin-bottom: 8px;
    }
    /* Links as vertical bulleted list */
    footer ul.footer-links {
        display: block !important;
        list-style: disc !important;
        padding-left: 20px;
        margin: 0 0 8px 0;
    }
    footer ul.footer-links li {
        display: list-item !important;
        float: none !important;
        width: auto !important;
        margin: 6px 0;
    }
    footer ul.footer-links li a {
        color: #3d4144;
        text-decoration: none;
    }
    footer ul.footer-links li a:hover {
        text-decoration: underline;
    }
}
@media (min-width: 768px) and (max-width: 991px) {
    footer p.float-right { font-size: 13px; }
}

/* 4. FORM INPUTS */
@media (max-width: 991px) {
    .input-organization-name, .input-address, .input-organization-address,
    .input-large, .input-width-870, .input-width-400, .input-width-420,
    .input-width-264, .input-width-300, .input-textarea,
    .input-textarea-in-container, .input-full-width {
        width: 100%; max-width: 100%; box-sizing: border-box;
    }
    select { max-width: 100%; }
}
@media (max-width: 767px) {
    .input-generic, .input-bank, .input-file, .input-sa-list,
    .input-group-user-profile, .col-xs-user-profile,
    .form-control, .form-control-flight {
        width: 100%; max-width: 100%; box-sizing: border-box;
    }
    .input-money, .input-integer, .input-decimal, .input-decimal-positive,
    .input-width-date, .input-width-time, .input-width-year,
    .input-width-month, .input-width-day, .input-width-36 {
        width: auto; min-width: 80px;
    }
    .login-bg { padding: 28px 14px 48px 14px; }
    .login-form { width: 100%; }
    .login-viss { max-width: 100%; height: auto; }
}

/* 5. TABLES */
@media (max-width: 480px) {
    .table-border td[data-label]::before { display: block; margin-bottom: 2px; font-size: 12px; color: #777; }
    .table-border td { font-size: 13px; }
}
@media (max-width: 991px) {
    .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; border: none; }
}

/* 6. PAGINATOR */
@media (max-width: 991px) {
    .paginator-1, .paginator-2, .paginator-3, .paginator-4 {
        float: none !important;
        display: block;
        margin: 2px 0;
    }
    /* Page size input + label on same row */
    .paginator-2 {
        display: inline-block;
        width: auto;
    }
    .paginator-2 .form-control {
        display: inline-block;
        width: 60px;
    }
    .paginator-1 {
        display: inline-block;
        vertical-align: middle;
        margin-left: 6px;
    }
    nav {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 4px;
    }
    nav .paginator-3 {
        order: 1;
        width: 100%;
        text-align: center;
    }
    nav .pull-left {
        float: none !important;
        order: 2;
        margin-top: 0;
    }
    nav .paginator-1 {
        order: 3;
        margin-left: auto;
        margin-top: 0;
        margin-bottom: 0;
    }
    nav .paginator-2 {
        order: 4;
        margin-top: 0;
        margin-bottom: 0;
    }
    .paginator-3 .pagination {
        margin: 4px 0;
        flex-wrap: wrap;
    }
}

/* 7. BUTTONS */
@media (max-width: 767px) {
    .btn-container { margin-top: 16px; }
    .btn-container .btn, .btn-container .btn-default {
        display: inline-block; width: auto; margin-bottom: 10px;
        padding: 8px 20px; font-size: 15px; text-align: center;
    }
    .btn-right { float: none; display: inline-block; width: auto; margin-bottom: 10px; text-align: center; }
    .btn-button { margin-right: 6px; margin-bottom: 8px; }
    .btn-container-for-print { text-align: right; margin-bottom: 10px; }
}
@media (min-width: 768px) and (max-width: 991px) {
    .btn-container .btn, .btn-container .btn-default { padding: 8px 20px; font-size: 16px; }
}

/* 8. ATD HOME */
@media (max-width: 991px) { .col-atd-home { padding: 24px; } }
@media (max-width: 767px) {
    .col-atd-home { padding: 14px; }
    .col-atd-home table { width: 100%; }
}

/* 9. SIDEBAR */
@media (max-width: 767px) {
    .sidebar-right { border-left: none; border-top: 2px solid #eceef0; margin-top: 20px; padding-top: 14px; }
}

/* 10. TYPOGRAPHY */
@media (max-width: 767px) {
    .formatting-application-name { font-size: 22px; margin-bottom: 20px; }
    .input-header1 { font-size: 20px; margin-top: 30px; }
    .input-header2 { font-size: 14px; margin-top: 24px; }
    h1 { font-size: 22px; } h2 { font-size: 18px; } h3 { font-size: 16px; }
}

/* 11. REVIEW TABLE */
@media (max-width: 767px) {
    .review-table-container { overflow-x: hidden; }
    .review-table { min-width: 0; }
}

/* 12. PT-TABLE & SELECT2 */
@media (max-width: 767px) {
    .pt-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .application-fieldset { margin-bottom: 14px; }
    .select2-container { max-width: 100% !important; width: 100% !important; }
}

/* 13. COOKIE MODAL */
@media (min-width: 551px) and (max-width: 991px) {
    .coockie-modal-content { width: 70%; }
}

/* 14. PAYMENT */
@media (max-width: 480px) {
    .payment-table-border { padding: 10px 8px; }
    .payment-name, .payment-description { font-size: 14px; }
}

@media (max-width: 599px) {
    .payment-button {
        flex-wrap: wrap;
        justify-content: flex-end;
    }
    .payment-total-text {
        width: 100%;
        text-align: right;
    }
    .payment-button .btn + .btn {
        margin-top: 0 !important;
    }
}

/* 15. BURGER MENU */
.burger-btn { display: none; }

@media (max-width: 991px) {
    .burger-btn {
        display: flex;
        align-items: center;
        gap: 10px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 8px 14px;
        font-size: 15px;
        cursor: pointer;
        color: #3d4144;
        width: 100%;
        text-align: left;
        margin-bottom: 0;
        box-sizing: border-box;
    }
    .burger-icon { font-size: 22px; line-height: 1; }
    .burger-label-group { display: flex; flex-direction: column; line-height: 1.2; }
    .burger-main-label { font-weight: bold; font-size: 15px; }
    .burger-active-label { font-size: 12px; color: #888; font-weight: normal; }

    .nav-tabs-container {
        position: relative;
        margin-bottom: 8px;
    }

    .nav-tabs-container .nav-tabs {
        display: none !important;
        border-bottom: none !important;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 0 0 4px 4px;
        margin: 0;
        padding: 0;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        z-index: 1000;
        box-shadow: 0 4px 8px rgba(0,0,0,0.12);
    }

    .nav-tabs-container.open .nav-tabs {
        display: block !important;
    }

    .nav-tabs-container .nav-tabs > li {
        float: none !important;
        width: 100%;
        margin: 0 !important;
        border-bottom: 1px solid #eee;
    }

    .nav-tabs-container .nav-tabs > li:last-child {
        border-bottom: none;
    }

    .nav-tabs-container .nav-tabs > li > a {
        display: block !important;
        padding: 10px 16px !important;
        border: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        color: #3d4144;
        background: #fff;
    }

    .nav-tabs-container .nav-tabs > li.active > a,
    .nav-tabs-container .nav-tabs > li.active > a:hover,
    .nav-tabs-container .nav-tabs > li.active > a:focus {
        background: #f5f7f9 !important;
        color: #3d4144 !important;
        border: none !important;
    }

    .nav-tabs-container .nav-tabs > li > a:hover {
        background: #f0f2f4 !important;
    }
}

/* 16. DOCUMENT TYPE DROPDOWN (my-documents sidebar) */
@media (max-width: 991px) {
    .doc-type-panel .list-group-item-link {
        display: flex;
        align-items: flex-start;
        gap: 6px;
    }
    .doc-type-panel .list-group-item-link .badge {
        flex-shrink: 0;
        margin-left: auto;
        float: none;
    }
}
.doc-type-toggle { display: none; }

@media (max-width: 991px) {
    .doc-type-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: #E75838;
        color: #fff;
        border: none;
        padding: 10px 14px;
        font-size: 15px;
        font-weight: bold;
        cursor: pointer;
        border-radius: 4px 4px 0 0;
        box-sizing: border-box;
    }
    .doc-type-arrow {
        font-size: 12px;
        transition: transform 0.2s;
    }
    .doc-type-panel.open .doc-type-arrow {
        transform: rotate(180deg);
    }
    .doc-type-panel .list-group {
        display: none;
        margin-bottom: 0;
    }
    .doc-type-panel.open .list-group {
        display: block;
    }
    .doc-type-panel {
        margin-bottom: 12px;
    }
}

/* 17. SEARCH FILTER TOGGLE */
.search-filter-toggle { display: none; }

@media (max-width: 991px) {
    .search-filter-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: #f5f7f9;
        color: #3d4144;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 8px 14px;
        font-size: 15px;
        font-weight: bold;
        cursor: pointer;
        box-sizing: border-box;
        margin-bottom: 4px;
    }
    .search-filter-arrow {
        font-size: 12px;
        transition: transform 0.2s;
    }
    .search-filter-arrow.open {
        transform: rotate(180deg);
    }
    .search-filter-body {
        display: none;
    }
    .search-filter-body.open {
        display: block;
    }
    .search-filter-body .float-left {
        float: none !important;
        display: block;
        width: 100%;
    }
    .search-filter-body .input-group-md {
        display: flex;
        align-items: center;
        flex-wrap: nowrap;
    }
    .search-filter-body .input-group-md .float-left {
        display: block !important;
        width: auto !important;
    }
    .search-filter-body .input-group-md .float-left:first-child {
        flex: 1;
        min-width: 0;
    }
    .search-filter-body .input-group-md .float-left:first-child .form-control {
        width: 100%;
    }
    .search-filter-body .panel-location-left-20,
    .search-filter-body .panel-location-left-40 {
        margin-left: 0 !important;
    }
    .search-filter-body .input-group {
        width: 100%;
    }
}

/* 18. FACET FILTER DROPDOWN (my-documents sidebar) */
.facet-toggle { display: none; }

@media (max-width: 991px) {
    .facet-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: #f5f7f9;
        color: #3d4144;
        border: 1px solid #ddd;
        border-radius: 4px;
        padding: 8px 14px;
        font-size: 14px;
        font-weight: bold;
        cursor: pointer;
        box-sizing: border-box;
        margin-bottom: 4px;
    }
    .facet-arrow {
        font-size: 12px;
        transition: transform 0.2s;
    }
    .facet-panel.open .facet-arrow {
        transform: rotate(180deg);
    }

    /* Collapsed: hide everything */
    .facet-panel:not(.open) .facet-body {
        display: none;
    }
    /* Collapsed with selection: show body but only selected items */
    .facet-panel.has-selection:not(.open) .facet-body {
        display: block;
    }
    .facet-panel.has-selection:not(.open) .list-group-item {
        display: none;
    }
    .facet-panel.has-selection:not(.open) .list-group-item.facet-selected {
        display: block;
    }
    .facet-panel.has-selection:not(.open) .panel {
        border: none;
        box-shadow: none;
        margin-bottom: 0;
    }
    .facet-panel.has-selection:not(.open) .panel-heading {
        display: none;
    }
    .facet-panel.has-selection:not(.open) .image-link-link {
        display: none;
    }

    /* Open: show everything normally */
    .facet-panel.open .facet-body {
        display: block;
    }
}

/* 19. PAKALPOJUMI PAGE */
@media (max-width: 991px) {
    .pakalpojumi-header-section { margin-bottom: 0; }
}

/* 20. PAKALPOJUMI SIDEBAR DROPDOWN */
.pak-type-toggle { display: none; }

@media (max-width: 991px) {
    .pak-type-toggle {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        background: #E75838;
        color: #fff;
        border: none;
        padding: 10px 14px;
        font-size: 15px;
        font-weight: bold;
        cursor: pointer;
        border-radius: 4px;
        box-sizing: border-box;
        margin-bottom: 4px;
    }
    .pak-type-toggle .burger-label-group { flex: 1; min-width: 0; text-align: left; }
    .pak-type-toggle .burger-main-label { color: #fff; }
    .pak-type-toggle .burger-active-label { color: rgba(255,255,255,0.85); }
    .pak-type-arrow {
        font-size: 12px;
        transition: transform 0.2s;
    }
    .pak-type-panel.open .pak-type-arrow {
        transform: rotate(180deg);
    }
    .pak-type-panel .pak-type-body {
        display: none;
    }
    .pak-type-panel.open .pak-type-body {
        display: block;
    }
}

/* 18. ACTION BUTTONS (mobile-btn) */
@media (max-width: 991px) {
    a.mobile-btn {
        display: inline-block;
        background: #E75838;
        color: #fff !important;
        border: 1px solid #d83526;
        border-radius: 3px;
        padding: 5px 16px;
        font-size: 14px;
        text-decoration: none !important;
        margin: 2px 0;
        cursor: pointer;
    }
    a.mobile-btn:hover {
        background: #c03617;
        color: #fff !important;
    }
    /* Action cell: hide label, right-align button + secondary links */
    .table-border td:has(a.mobile-btn) .mobile-label {
        display: none !important;
    }
    .table-border td:has(a.mobile-btn) .mobile-value {
        display: flex !important;
        flex-direction: column;
        align-items: flex-end;
        gap: 2px;
        width: 100%;
    }
    .table-border td:has(a.mobile-btn) .mobile-value a:not(.mobile-btn) {
        font-size: 13px;
    }
}

/* 24. SELECT2 — MATCH BOOTSTRAP FORM-CONTROL SIZE */
.select2-container .select2-selection--single {
    height: 34px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 34px;
    font-size: 14px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 34px;
}
.select2-dropdown {
    font-size: 14px;
}

/* 25. BASKET BRANCH / PARCEL DROPDOWNS - MOBILE */
@media (max-width: 767px) {
    #ApplicationBranch_DropDown,
    #ApplicationParcel_DropDown {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        float: none !important;
    }
    .input-group:has(#ApplicationBranch_DropDown),
    .input-group:has(#ApplicationParcel_DropDown) {
        display: block !important;
        width: 100% !important;
        max-width: 100% !important;
    }
}

/* 26. JQUERY UI DIALOGS - MOBILE */
@media (max-width: 599px) {
    .ui-dialog-content {
        overflow-x: hidden;
        overflow-y: auto;
        max-height: 65vh;
    }
    .ui-dialog-title {
        white-space: normal;
        word-break: break-word;
        line-height: 1.3;
        padding-right: 25px;
    }
}
