/* ========================================
   PAGINATION - MODERN ENTERPRISE DESIGN
   Shared pagination styles for non-admin pages

   Used by: Tickets, Timetables, Disruptions,
            Wallet, Stations, Lines
   ======================================== */

/* ----------------------------------------
   PAGINATION CONTAINER
   Three-column layout: info | pages | size
   ---------------------------------------- */
.tickets-pagination,
.timetables-pagination,
.wallet-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    gap: 16px;
}

.stations-pagination,
.lines-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 24px;
    gap: 16px;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-top: 24px;
    padding: 16px 0;
}

/* ----------------------------------------
   PAGINATION INFO TEXT
   "Showing 1-12 of 48"
   ---------------------------------------- */
.pagination-info {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-muted, #94A3B8);
    white-space: nowrap;
    flex-shrink: 0;
    letter-spacing: 0.01em;
}

/* ----------------------------------------
   PAGINATION CENTER (Page buttons wrapper)
   ---------------------------------------- */
.pagination-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex: 1;
}

.pagination-size {
    flex-shrink: 0;
}

/* ----------------------------------------
   PAGE NUMBERS CONTAINER
   ---------------------------------------- */
.page-numbers {
    display: flex;
    align-items: center;
    gap: 2px;
}

/* ----------------------------------------
   PAGE BUTTON - Base
   Modern pill-shaped with subtle depth
   ---------------------------------------- */
.page-btn {
    min-width: 38px;
    height: 38px;
    border: 1px solid var(--color-border-primary, #E2E8F0);
    border-radius: 10px;
    background: var(--color-bg-primary, #FFFFFF);
    color: var(--color-text-primary, #334155);
    font-size: 13.5px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    user-select: none;
    position: relative;
}

/* Hover */
.page-btn:hover:not(:disabled):not(.active) {
    background: var(--color-bg-tertiary, #F1F5F9);
    border-color: var(--color-border-secondary, #CBD5E1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

/* Disabled */
.page-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    box-shadow: none;
}

/* Active (current page) */
.page-btn.active {
    background: linear-gradient(135deg, var(--color-primary, #1A7CCA) 0%, var(--color-primary-hover, #1568A8) 100%);
    border-color: transparent;
    color: var(--color-text-inverse, #FFFFFF);
    box-shadow: 0 2px 8px rgba(26, 124, 202, 0.3),
                0 1px 2px rgba(26, 124, 202, 0.15);
    font-weight: 700;
}

/* Focus-visible for keyboard a11y */
.page-btn:focus-visible {
    outline: 2px solid var(--color-primary, #1A7CCA);
    outline-offset: 2px;
}

/* ----------------------------------------
   NAV BUTTON (Prev/Next arrows)
   Transparent ghost style
   ---------------------------------------- */
.page-btn.nav-btn {
    border: 1px solid transparent;
    background: transparent;
    box-shadow: none;
    color: var(--color-text-secondary, #64748B);
    min-width: 36px;
    height: 36px;
}

.page-btn.nav-btn:hover:not(:disabled) {
    color: var(--color-primary, #1A7CCA);
    background: rgba(26, 124, 202, 0.06);
    border-color: rgba(26, 124, 202, 0.1);
}

.page-btn.nav-btn:active:not(:disabled) {
    background: rgba(26, 124, 202, 0.1);
    transform: scale(0.96);
}

.page-btn.nav-btn svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* ----------------------------------------
   ELLIPSIS
   ---------------------------------------- */
.page-ellipsis {
    min-width: 32px;
    height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted, #94A3B8);
    font-size: 14px;
    font-weight: 600;
    user-select: none;
    letter-spacing: 0.1em;
}

/* ----------------------------------------
   PAGE SIZE DROPDOWN - Custom styled
   Matches ModernDropdown visual pattern
   ---------------------------------------- */
.page-size-dropdown {
    position: relative;
    flex-shrink: 0;
}

.page-size-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px;
    background: var(--color-bg-primary, #FFFFFF);
    border: 1px solid var(--color-border-primary, #E2E8F0);
    border-radius: 10px;
    cursor: pointer;
    transition: all 200ms cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    font-family: inherit;
    user-select: none;
}

.page-size-trigger:hover {
    border-color: var(--color-border-secondary, #CBD5E1);
    background: #F8FAFC;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.page-size-dropdown.open .page-size-trigger {
    border-color: var(--color-primary, #1A7CCA);
    box-shadow: 0 0 0 3px rgba(26, 124, 202, 0.12);
    background: var(--color-bg-primary, #FFFFFF);
}

.page-size-trigger:focus-visible {
    outline: 2px solid var(--color-primary, #1A7CCA);
    outline-offset: 2px;
}

.page-size-value {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--color-text-primary, #334155);
    line-height: 1;
}

.page-size-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--color-text-muted, #94A3B8);
    line-height: 1;
    white-space: nowrap;
}

.page-size-arrow {
    color: #64748B;
    flex-shrink: 0;
    transition: transform 200ms cubic-bezier(0.4, 0, 0.2, 1);
    width: 14px;
    height: 14px;
}

.page-size-dropdown.open .page-size-arrow {
    transform: rotate(180deg);
}

/* Dropdown menu */
.page-size-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    min-width: 100%;
    background: #FFFFFF;
    border: 1px solid #E2E8F0;
    border-radius: 12px;
    box-shadow: 0 12px 28px -8px rgba(0, 0, 0, 0.12),
                0 4px 12px -4px rgba(0, 0, 0, 0.08);
    z-index: 1000;
    overflow: hidden;
    padding: 6px;
    animation: pageSizeSlideIn 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pageSizeSlideIn {
    from {
        opacity: 0;
        transform: translateY(6px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.page-size-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 150ms ease;
    font-size: 13.5px;
    font-weight: 500;
    color: #0F172A;
    white-space: nowrap;
}

.page-size-option:hover {
    background: #F8FAFC;
}

.page-size-option.selected {
    background: linear-gradient(135deg, #EFF6FF 0%, #DBEAFE 100%);
    color: #1A7CCA;
    font-weight: 600;
}

.page-size-option.selected:hover {
    background: linear-gradient(135deg, #DBEAFE 0%, #BFDBFE 100%);
}

.page-size-option .check-icon {
    width: 14px;
    height: 14px;
    color: #1A7CCA;
    flex-shrink: 0;
}

/* Backdrop overlay for closing */
.page-size-backdrop {
    position: fixed;
    inset: 0;
    z-index: 999;
}

/* Legacy native select fallback (keeping for backward compat) */
select.page-size-select,
.page-size-select select,
.pagination-size select {
    height: 38px;
    padding: 0 34px 0 14px;
    background: var(--color-bg-primary, #FFFFFF);
    border: 1px solid var(--color-border-primary, #E2E8F0);
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--color-text-primary, #334155);
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
    outline: none;
}

select.page-size-select:hover,
.page-size-select select:hover,
.pagination-size select:hover {
    border-color: var(--color-border-secondary, #CBD5E1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

select.page-size-select:focus,
select.page-size-select:focus-visible,
.page-size-select select:focus,
.pagination-size select:focus {
    outline: none;
    border-color: var(--color-primary, #1A7CCA);
    box-shadow: 0 0 0 3px rgba(26, 124, 202, 0.1);
}

/* ========================================
   LEGACY PAGINATION SUPPORT
   Preserved for backward compatibility
   with older pagination component
   ======================================== */
.pagination-main-container {
    display: flex;
    flex-direction: row;
    justify-content: normal;
    margin-top: 12px;
    align-items: center;
}

.pagination-container {
    display: flex;
    justify-content: center;
}

.pagination-button {
    width: 38px;
    height: 38px;
    font-size: 13.5px;
    line-height: 20px;
    font-weight: 600;
    border-radius: 10px;
    border: 1px solid var(--color-border-primary, #E2E8F0);
    background: var(--color-bg-primary, #FFFFFF);
    margin: 0px 3px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pagination-button:hover:not(:disabled) {
    background: var(--color-bg-tertiary, #F1F5F9);
    border-color: var(--color-border-secondary, #CBD5E1);
}

.pagination-button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-btn-active {
    background: linear-gradient(135deg, var(--color-primary, #1A7CCA) 0%, var(--color-primary-hover, #1568A8) 100%) !important;
    border-color: transparent !important;
    color: var(--color-text-inverse, #FFFFFF) !important;
    box-shadow: 0 2px 8px rgba(26, 124, 202, 0.3);
    font-weight: 700;
}

.pagination-button-load-more {
    width: 38px;
    height: 38px;
    margin: 0px 3px;
    border: none;
    background-color: inherit;
}

.pagination-total-pages label {
    font-family: inherit;
    font-weight: 500;
    font-size: 13px;
    line-height: 20px;
    color: var(--color-text-muted, #94A3B8);
}

.pagination-pages-dropdown select {
    float: right;
    font-size: 13.5px;
    line-height: 20px;
    font-weight: 500;
    padding: 8px 34px 8px 14px;
    border: 1px solid var(--color-border-primary, #E2E8F0);
    border-radius: 10px;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='14' height='14' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 6L8 10L12 6' stroke='%2364748B' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    color: var(--color-text-primary, #334155);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.pagination-pages-dropdown select:hover {
    border-color: var(--color-border-secondary, #CBD5E1);
}

.pagination-pages-dropdown select:focus {
    outline: none;
    border-color: var(--color-primary, #1A7CCA);
    box-shadow: 0 0 0 3px rgba(26, 124, 202, 0.1);
}

/* ========================================
   RESPONSIVE - Tablet (<=991.98px)
   ======================================== */
@media screen and (max-width: 991.98px) {
    .page-btn {
        min-width: 36px;
        height: 36px;
        font-size: 13px;
        border-radius: 9px;
    }

    .page-btn.nav-btn {
        min-width: 34px;
        height: 34px;
    }

    .page-ellipsis {
        min-width: 28px;
        height: 36px;
    }

    .page-size-select,
    .pagination-size select,
    .page-size-select select {
        height: 36px;
        font-size: 13px;
    }

    .page-size-trigger {
        height: 36px;
        border-radius: 9px;
    }

    .page-size-value {
        font-size: 13px;
    }

    .page-size-menu {
        border-radius: 10px;
    }

    .page-size-option {
        font-size: 13px;
        padding: 8px 11px;
    }
}

/* ========================================
   RESPONSIVE - Mobile (<=767.98px)
   ======================================== */
@media screen and (max-width: 767.98px) {
    /* Stack layout on mobile */
    .tickets-pagination,
    .timetables-pagination,
    .wallet-pagination,
    .stations-pagination,
    .lines-pagination {
        flex-direction: column;
        gap: 14px;
        align-items: center;
    }

    .pagination-info {
        text-align: center;
        font-size: 12.5px;
    }

    .pagination-center {
        flex: none;
        width: 100%;
        justify-content: center;
    }

    .pagination-size {
        width: 100%;
    }

    .pagination-size select,
    .page-size-select {
        width: 100%;
    }

    .page-size-dropdown {
        width: 100%;
    }

    .page-size-trigger {
        width: 100%;
        justify-content: center;
        height: 34px;
        border-radius: 8px;
    }

    .page-size-menu {
        left: 0;
        right: 0;
        min-width: auto;
    }

    /* Centered pagination on mobile */
    .pagination-bar {
        flex-direction: column;
        gap: 10px;
        margin-top: 16px;
        padding: 12px 0;
    }

    .page-btn {
        min-width: 34px;
        height: 34px;
        font-size: 12.5px;
        border-radius: 8px;
    }

    .page-btn.nav-btn {
        min-width: 32px;
        height: 32px;
    }

    .page-btn.nav-btn svg {
        width: 16px;
        height: 16px;
    }

    .page-ellipsis {
        min-width: 24px;
        height: 34px;
        font-size: 13px;
    }

    .page-size-select,
    .pagination-size select,
    .page-size-select select {
        height: 34px;
        font-size: 12.5px;
        border-radius: 8px;
    }

    /* Legacy mobile */
    .pagination-total-pages {
        display: none;
    }

    .pagination-pages-dropdown {
        display: none;
    }

    .pagination-container {
        width: 100%;
    }

    .pagination-button-load-more {
        width: 12px;
    }

    .pagination-button {
        width: 34px;
        height: 34px;
        font-size: 12.5px;
    }
}

/* ========================================
   RESPONSIVE - Small mobile (<=575.98px)
   ======================================== */
@media screen and (max-width: 575.98px) {
    .page-btn {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
        border-radius: 8px;
    }

    .page-btn.nav-btn {
        min-width: 30px;
        height: 30px;
    }

    .page-ellipsis {
        min-width: 20px;
        height: 32px;
    }

    .page-size-select,
    .pagination-size select,
    .page-size-select select {
        height: 32px;
        font-size: 12px;
    }

    .page-size-trigger {
        height: 32px;
        padding: 0 10px;
        gap: 6px;
    }

    .page-size-value {
        font-size: 12px;
    }

    .page-size-label {
        font-size: 11px;
    }

    .page-size-option {
        font-size: 12.5px;
        padding: 8px 10px;
        border-radius: 6px;
    }

    .pagination-button {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* ========================================
   ACCESSIBILITY
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .page-btn,
    .page-btn.nav-btn,
    .page-size-select,
    .page-size-select select,
    .pagination-size select,
    .page-size-trigger,
    .page-size-arrow,
    .page-size-option,
    .pagination-button,
    .pagination-pages-dropdown select {
        transition: none;
    }

    .page-size-menu {
        animation: none;
    }
}

@media (prefers-contrast: high) {
    .page-btn {
        border-width: 2px;
    }

    .page-btn.active {
        outline: 2px solid currentColor;
        outline-offset: 1px;
    }

    .page-btn.nav-btn {
        border: 1px solid currentColor;
    }
}
