/* ===============================
   PAGINATION COMPONENT STYLES
   Clean Modern Design with Yellow Accent
   =============================== */

/* ---------- PAGINATION WRAPPER ---------- */
.pgn {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: var(--brand-white, #fff);
    border-radius: var(--brand-radius-lg, 0.75rem);
    margin-top: 1.5rem;
    box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.04);
}

/* ---------- PAGINATION NAV ---------- */
.pgn__nav {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0;
    margin: 0;
}

.pgn__nav .page-item {
    list-style: none;
}

/* Page link base styles - clean outlined circles */
.pgn__nav .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--brand-grey-600, #6c757d);
    background: transparent;
    border: 1.5px solid var(--brand-grey-300, #dee2e6);
    border-radius: 50%;
    text-decoration: none;
    transition: all 0.2s ease;
    cursor: pointer;
}

.pgn__nav .page-link:hover {
    background: var(--brand-accent, #fff8e1);
    border-color: var(--brand-primary, #ffd33b);
    color: var(--brand-grey-800, #343a40);
}

.pgn__nav .page-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 211, 59, 0.3);
}

/* Active page - outlined with yellow ring */
.pgn__nav .page-item.active .page-link {
    background: transparent;
    border: 2px solid var(--brand-primary, #ffd33b);
    color: var(--brand-grey-800, #343a40);
    font-weight: 600;
    box-shadow: 0 0 0 3px rgba(255, 211, 59, 0.2);
}

/* Disabled state */
.pgn__nav .page-item.disabled .page-link {
    background: transparent;
    border-color: var(--brand-grey-200, #e9ecef);
    color: var(--brand-grey-400, #ced4da);
    cursor: not-allowed;
    pointer-events: none;
}

/* Prev/Next buttons - minimal chevrons */
.pgn__nav .page-item.prev .page-link,
.pgn__nav .page-item.next .page-link {
    border: none;
    background: transparent;
    min-width: 1.75rem;
    color: var(--brand-grey-500, #6c757d);
}

.pgn__nav .page-item.prev .page-link:hover,
.pgn__nav .page-item.next .page-link:hover {
    background: transparent;
    color: var(--brand-primary-dark, #e6be35);
}

.pgn__nav .page-item.prev.disabled .page-link,
.pgn__nav .page-item.next.disabled .page-link {
    color: var(--brand-grey-300, #dee2e6);
}

/* Ellipsis */
.pgn__nav .page-item.ellipsis .page-link {
    background: transparent;
    border: none;
    cursor: default;
    pointer-events: none;
    color: var(--brand-grey-400, #ced4da);
}

/* ---------- PER PAGE SELECTOR ---------- */
.pgn__per-page {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pgn__per-page label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--brand-grey-500, #6c757d);
    white-space: nowrap;
    margin: 0;
}

.pgn__per-page select {
    min-width: 6rem;
    height: 2rem;
    padding: 0 1.75rem 0 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--brand-grey-700, #495057);
    background: var(--brand-white, #fff) url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%236c757d' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e") no-repeat right 0.5rem center/0.65rem;
    border: 1.5px solid var(--brand-grey-300, #dee2e6);
    border-radius: 1rem;
    appearance: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pgn__per-page select:hover {
    border-color: var(--brand-primary, #ffd33b);
}

.pgn__per-page select:focus {
    outline: none;
    border-color: var(--brand-primary, #ffd33b);
    box-shadow: 0 0 0 3px rgba(255, 211, 59, 0.2);
}

/* ---------- GO TO PAGE ---------- */
.pgn__goto {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pgn__goto label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--brand-grey-500, #6c757d);
    white-space: nowrap;
    margin: 0;
}

.pgn__goto input {
    width: 3rem;
    height: 2rem;
    padding: 0 0.25rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--brand-grey-700, #495057);
    background: var(--brand-white, #fff);
    border: 1.5px solid var(--brand-grey-300, #dee2e6);
    border-radius: 1rem;
    text-align: center;
    transition: all 0.2s ease;
}

.pgn__goto input:hover {
    border-color: var(--brand-primary, #ffd33b);
}

.pgn__goto input:focus {
    outline: none;
    border-color: var(--brand-primary, #ffd33b);
    box-shadow: 0 0 0 3px rgba(255, 211, 59, 0.2);
}

.pgn__goto input::-webkit-outer-spin-button,
.pgn__goto input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pgn__goto input[type=number] {
    -moz-appearance: textfield;
}

/* ---------- PAGE INFO ---------- */
.pgn__info {
    font-size: 1rem;
    font-weight: 500;
    color: var(--brand-grey-500, #6c757d);
    text-align: center;
    margin-top: 0.25rem;
    width: 100%;
}

.pgn__info strong {
    color: var(--brand-grey-700, #495057);
}

/* ---------- COMPACT VARIANT ---------- */
.pgn.compact {
    padding: 0.625rem 1rem;
    gap: 0.75rem;
}

.pgn.compact .pgn__nav .page-link {
    min-width: 1.75rem;
    height: 1.75rem;
    font-size: 0.8125rem;
}

.pgn.compact .pgn__per-page select,
.pgn.compact .pgn__goto input {
    height: 1.75rem;
    font-size: 1rem;
}

/* ---------- MINIMAL VARIANT ---------- */
.pgn.minimal {
    background: transparent;
    padding: 0.5rem 0;
    box-shadow: none;
}

/* ---------- RESPONSIVE DESIGN ---------- */

/* Tablet view */
@media (max-width: 991.98px) {
    .pgn {
        gap: 0.75rem;
        padding: 0.875rem 1rem;
    }
}

/* Mobile view */
@media (max-width: 767.98px) {
    .pgn {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.625rem;
        padding: 0.75rem;
        background: var(--brand-white, #fff);
        border: 1px solid var(--brand-grey-200, #e9ecef);
        box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.04);
    }

    /* Nav stays in center row */
    .pgn__nav {
        order: 1;
        width: 100%;
        justify-content: center;
        gap: 0.25rem;
    }

    .pgn__nav .page-link {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.8125rem;
    }

    /* Active state ring on mobile */
    .pgn__nav .page-item.active .page-link {
        box-shadow: 0 0 0 2px rgba(255, 211, 59, 0.3);
    }

    /* Per-page and goto in row below */
    .pgn__per-page {
        order: 2;
    }

    .pgn__goto {
        order: 3;
    }

    .pgn__per-page,
    .pgn__goto {
        flex-direction: row;
        align-items: center;
        gap: 0.375rem;
    }

    .pgn__per-page select {
        min-width: 5.5rem;
        height: 1.875rem;
        font-size: 1rem;
        padding: 0 1.5rem 0 0.625rem;
    }

    .pgn__goto input {
        width: 2.5rem;
        height: 1.875rem;
        font-size: 1rem;
    }

    .pgn__goto label {
        font-size: 1rem;
    }

    .pgn__info {
        order: 4;
        width: 100%;
        margin-top: 0.25rem;
        padding-top: 0.5rem;
        border-top: 1px solid var(--brand-grey-200, #e9ecef);
        font-size: 0.6875rem;
    }

    /* Hide ellipsis on mobile */
    .pgn__nav .page-item.ellipsis {
        display: none;
    }

    /* Hide some page numbers on mobile for cleaner look */
    .pgn__nav .page-item.hide-mobile {
        display: none;
    }
}

/* Small mobile view (576px and below) */
@media (max-width: 576px) {
    .pgn {
        padding: 0.5rem;
        gap: 0.5rem;
        border-radius: var(--brand-radius-md, 0.5rem);
    }

    .pgn__nav {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
    }

    .pgn__nav .page-item {
        margin: 0.125rem;
    }

    /* Touch-friendly minimum 44px targets for accessibility */
    .pgn__nav .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        font-size: 0.875rem;
        border-width: 1px;
    }

    .pgn__nav .page-item.active .page-link {
        border-width: 1.5px;
    }

    /* Hide some page numbers on very small screens - show first, last, prev/next adjacent, and active */
    .pgn__nav .page-item:not(.active):not(.prev):not(.next):not(:nth-child(2)):not(:nth-last-child(2)) {
        display: none;
    }

    .pgn__nav .page-item.active {
        order: 0;
    }

    /* Ellipsis indicator for mobile pagination */
    .pgn__ellipsis {
        display: flex;
        align-items: center;
        padding: 0 0.5rem;
        color: var(--brand-grey-500, #6c757d);
        font-size: 0.875rem;
    }

    .pgn__per-page,
    .pgn__goto {
        flex: 1;
        justify-content: center;
    }

    .pgn__per-page select {
        min-width: 5rem;
        height: 2.75rem;
        min-height: 44px;
        font-size: 0.875rem;
    }

    .pgn__goto input {
        width: 3rem;
        height: 2.75rem;
        min-height: 44px;
        font-size: 0.875rem;
    }

    .pgn__goto label {
        font-size: 0.875rem;
    }

    .pgn__info {
        font-size: 1rem;
    }
}

/* ---------- BOOTSTRAP OVERRIDE ---------- */
/* Override Bootstrap pagination styles for consistency */
.pagination {
    gap: 0.375rem;
    margin-bottom: 0;
    padding: 0;
}

.pagination .page-item .page-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    height: 2rem;
    padding: 0;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--brand-grey-600, #6c757d);
    background: transparent;
    border: 1.5px solid var(--brand-grey-300, #dee2e6);
    border-radius: 50% !important;
    text-decoration: none;
    transition: all 0.2s ease;
}

.pagination .page-item .page-link:hover {
    background: var(--brand-accent, #fff8e1);
    border-color: var(--brand-primary, #ffd33b);
    color: var(--brand-grey-800, #343a40);
    z-index: 2;
}

.pagination .page-item .page-link:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 211, 59, 0.3);
    z-index: 3;
}

.pagination .page-item.active .page-link {
    background: transparent;
    border: 2px solid var(--brand-primary, #ffd33b);
    color: var(--brand-grey-800, #343a40);
    font-weight: 600;
    box-shadow: 0 0 0 3px rgba(255, 211, 59, 0.2);
    z-index: 2;
}

.pagination .page-item.disabled .page-link {
    background: transparent;
    border-color: var(--brand-grey-200, #e9ecef);
    color: var(--brand-grey-400, #ced4da);
    pointer-events: none;
}

/* First and last page links - prev/next buttons */
.pagination .page-item:first-child .page-link,
.pagination .page-item:last-child .page-link {
    border: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.pagination .page-item:first-child .page-link:hover,
.pagination .page-item:last-child .page-link:hover {
    color: var(--brand-primary-dark, #e6be35);
}

/* ---------- BOOTSTRAP PAGINATION MOBILE ---------- */
@media (max-width: 767.98px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
        padding: 0.5rem;
        background: var(--brand-white, #fff);
        border-radius: var(--brand-radius-md, 0.5rem);
        box-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.04);
    }

    .pagination .page-item .page-link {
        min-width: 2rem;
        height: 2rem;
        font-size: 0.8125rem;
    }

    .pagination .page-item.active .page-link {
        box-shadow: 0 0 0 2px rgba(255, 211, 59, 0.3);
    }
}

/* Bootstrap pagination mobile (576px and below) */
@media (max-width: 576px) {
    .pagination {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.25rem;
        padding: 0.375rem;
    }

    .pagination .page-item {
        margin: 0.125rem;
    }

    .pagination .page-item .page-link {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 0.5rem;
        font-size: 0.875rem;
        border-width: 1px;
    }

    .pagination .page-item.active .page-link {
        border-width: 1.5px;
    }

    /* Hide some page numbers on very small screens - show first, last, prev/next adjacent, and active */
    .pagination .page-item:not(.active):not(:first-child):not(:last-child):not(:nth-child(2)):not(:nth-last-child(2)) {
        display: none;
    }

    .pagination .page-item.active {
        order: 0;
    }

    /* Show ellipsis indicator */
    .pgn__ellipsis {
        display: flex;
        align-items: center;
        padding: 0 0.5rem;
        color: var(--brand-grey-500, #6c757d);
        font-size: 0.875rem;
    }
}
