/* ═══════════════════════════════════════════════════════════
   Postal Tracking — Public Styles
   Colors: #333665 → #5563BB  |  RTL / Persian
═══════════════════════════════════════════════════════════ */

:root {
    --pt-dark:     #333665;
    --pt-mid:      #424782;
    --pt-light:    #5563BB;
    --pt-accent:   #6B7DD6;
    --pt-bg:       #f0f2ff;
    --pt-bg2:      #f8f9ff;
    --pt-border:   #d0d4f0;
    --pt-text:     #1e2040;
    --pt-muted:    #6b7280;
    --pt-white:    #ffffff;
    --pt-success:  #10b981;
    --pt-radius:   12px;
    --pt-shadow:   0 4px 20px rgba(51,54,101,.14);
    --pt-shadow-sm:0 2px 8px  rgba(51,54,101,.09);
}

/* ── Wrapper ──────────────────────────────────────────── */
.pt-wrap {
    font-family: inherit;
    direction: rtl; max-width: 1200px; margin: 0 auto;
    padding: 30px 16px 40px; color: var(--pt-text);
}
.pt-wrap * { box-sizing: border-box; }

.hidden{display:none;}

/* ── Header ───────────────────────────────────────────── */
.pt-header {
    display: flex; align-items: center; gap: 18px;
    background: linear-gradient(135deg, var(--pt-dark) 0%, var(--pt-light) 100%);
    color: #fff; padding: 28px 32px; border-radius: var(--pt-radius);
    margin-bottom: 24px; box-shadow: var(--pt-shadow);
}
.pt-header__icon { font-size: 48px; line-height: 1; }
.pt-header__title { margin: 0; font-size: 26px; font-weight: 700; }
.pt-header__sub   { margin: 4px 0 0; font-size: 14px; opacity: .85; }

/* ── Navigation ───────────────────────────────────────── */
.pt-nav {
    background: var(--pt-white); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius); padding: 18px 20px;
    margin-bottom: 20px; box-shadow: var(--pt-shadow-sm);
}

/* Year tabs */
.pt-nav__years {
    display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px;
}
.pt-year-tab {
    padding: 7px 20px; border-radius: 5px; font-size: 14px; font-weight: 600;
    text-decoration: none; color: var(--pt-muted); border: 2px solid transparent;
    transition: all .2s; background: var(--pt-bg);
}
.pt-year-tab:hover  { color: var(--pt-mid); border-color: var(--pt-border); }
.pt-year-tab.active {
    background: linear-gradient(135deg, var(--pt-dark), var(--pt-light));
    color: #fff; border-color: transparent;
    box-shadow: 0 4px 12px rgba(85,99,187,.4);
}

/* Month pills */
.pt-nav__months {
    display: flex; flex-wrap: wrap; gap: 8px;
    padding-top: 14px; border-top: 1px solid var(--pt-border);
}
.pt-month-pill {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 16px; border-radius: 5px; font-size: 13px;
    text-decoration: none; color: var(--pt-muted); background: var(--pt-bg2);
    border: 1px solid var(--pt-border); transition: all .2s;
}
.pt-month-pill:hover { color: var(--pt-dark); border-color: var(--pt-accent); background: var(--pt-bg); }
.pt-month-pill.active {
    background: linear-gradient(135deg, var(--pt-mid), var(--pt-accent));
    color: #fff; border-color: transparent;
    box-shadow: 0 3px 10px rgba(85,99,187,.3);
}
.pt-month-pill__count {
    background: rgba(255,255,255,.25); border-radius: 99px;
    padding: 1px 8px; font-size: 11px; font-weight: 700;
}
.pt-month-pill.active .pt-month-pill__count { background: rgba(255,255,255,.3); color: #fff; }
.pt-month-pill:not(.active) .pt-month-pill__count {
    background: var(--pt-border); color: var(--pt-dark);
}

/* ── Search bar ───────────────────────────────────────── */
.pt-search-bar {
    background: var(--pt-white); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius); padding: 16px 20px;
    margin-bottom: 20px; box-shadow: var(--pt-shadow-sm);
}
.pt-search-bar__inner {
    display: flex; align-items: center;
    background: var(--pt-bg); border: 2px solid var(--pt-border);
    border-radius: 10px; padding: 0 18px; gap: 10px;
    transition: border .2s;
}
.pt-search-bar__inner:focus-within {
    border-color: var(--pt-light);
    box-shadow: 0 0 0 4px rgba(85,99,187,.15);
}
.pt-search-bar__icon { font-size: 18px; }
.pt-search-bar__input {
    flex: 1; border: none; background: none; padding: 12px 0;
    font-size: 14px; font-family: inherit; color: var(--pt-text);
    outline: none;
}
.pt-search-bar__input::placeholder { color: var(--pt-muted); }
.pt-search-bar__clear {
    background: none; border: none; cursor: pointer;
    color: var(--pt-muted); font-size: 16px; padding: 4px 8px;
    border-radius: 99px; transition: all .2s;
}
.pt-search-bar__clear:hover { background: var(--pt-border); color: var(--pt-text); }
.pt-search-bar__info {
    font-size: 12px; color: var(--pt-muted); margin-top: 8px; padding: 0 4px;
}

/* ── Table wrapper ────────────────────────────────────── */
.pt-table-wrap {
    background: var(--pt-white); border: 1px solid var(--pt-border);
    border-radius: var(--pt-radius); overflow: hidden;
    box-shadow: var(--pt-shadow-sm); position: relative; min-height: 200px;
}

/* ── Loading ──────────────────────────────────────────── */
.pt-loading {
    position: absolute; inset: 0; background: rgba(255,255,255,.85);
    display: flex; flex-direction: column; align-items: center;
    justify-content: center; gap: 14px; z-index: 10;
    border-radius: var(--pt-radius);
}
.pt-spinner {
    width: 40px; height: 40px;
    border: 4px solid var(--pt-bg); border-top-color: var(--pt-light);
    border-radius: 50%; animation: pt-spin .8s linear infinite;
}
@keyframes pt-spin { to { transform: rotate(360deg); } }
.pt-loading span { font-size: 13px; color: var(--pt-muted); }

/* ── Table ────────────────────────────────────────────── */
.pt-table {
    width: 100%; border-collapse: collapse; font-size: 13px;
}
.pt-table thead { background: linear-gradient(135deg, var(--pt-dark), var(--pt-mid)); color: #fff; }
.pt-table thead th {
    padding: 14px 16px; text-align: right; font-weight: 600;
    font-size: 13px; white-space: nowrap;
}
.pt-table thead th:first-child { border-radius: 0 0 0 0; }
.pt-th--idx { width: 50px; text-align: center !important; }
.pt-table tbody tr { border-bottom: 1px solid var(--pt-bg); transition: background .15s; }
.pt-table tbody tr:last-child { border-bottom: none; }
.pt-table tbody tr:hover { background: var(--pt-bg2); }
.pt-table tbody td { padding: 13px 16px; vertical-align: middle; }
.pt-td--idx { text-align: center; color: var(--pt-muted); font-size: 12px; }

/* Tracking code cell */
.pt-code {
    font-family: inherit; font-size: 12px;
    background: var(--pt-bg); padding: 4px 10px; border-radius: 6px;
    letter-spacing: .3px; color: var(--pt-mid); display: inline-block;
    max-width: 220px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; cursor: pointer; transition: all .2s;
    border: 1px solid var(--pt-border);
}
.pt-code:hover { background: var(--pt-border); }
.pt-code.copied { background: #d1fae5; color: var(--pt-success); border-color: #a7f3d0; }

/* Track button */
.pt-track-btn {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 7px 14px; border-radius: 5px;
    background: linear-gradient(135deg, var(--pt-dark), var(--pt-light));
    color: #fff; text-decoration: none; font-size: 12px; font-weight: 600;
    transition: all .2s; white-space: nowrap;
    box-shadow: 0 2px 8px rgba(85,99,187,.35);
}
.pt-track-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(85,99,187,.5);
    color: #fff; text-decoration: none;
}
.pt-track-btn svg { width: 13px; height: 13px; fill: currentColor; }

/* Highlight search matches */
.pt-highlight {
    background: #fef9c3; color: #78350f;
    border-radius: 3px; padding: 0 2px;
}

/* ── Pagination ───────────────────────────────────────── */
.pt-pagination {
    display: flex; justify-content: center; flex-wrap: wrap;
    gap: 6px; margin-top: 20px; padding: 0 4px;
}
.pt-page-btn {
    padding: 8px 14px; border-radius: 8px; font-size: 13px;
    font-family: inherit; cursor: pointer; border: 1px solid var(--pt-border);
    background: var(--pt-white); color: var(--pt-text); transition: all .2s;
}
.pt-page-btn:hover    { border-color: var(--pt-accent); color: var(--pt-light); }
.pt-page-btn.active   {
    background: linear-gradient(135deg, var(--pt-dark), var(--pt-light));
    color: #fff; border-color: transparent;
    box-shadow: 0 2px 8px rgba(85,99,187,.35);
}
.pt-page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Empty / no-results ───────────────────────────────── */
.pt-empty-state, .pt-no-results {
    text-align: center; padding: 50px 20px; color: var(--pt-muted);
}
.pt-empty-state__icon, .pt-no-results__icon { font-size: 48px; margin-bottom: 14px; }
.pt-empty-state p, .pt-no-results p { font-size: 15px; }

/* ── Copy toast ───────────────────────────────────────── */
.pt-toast {
    position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%);
    background: var(--pt-dark); color: #fff; padding: 10px 24px;
    border-radius: 99px; font-size: 13px; z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,.25);
    animation: pt-toast-in .3s ease, pt-toast-out .3s ease 1.7s forwards;
}
@keyframes pt-toast-in  { from { opacity:0; transform: translateX(-50%) translateY(12px); } }
@keyframes pt-toast-out { to   { opacity:0; transform: translateX(-50%) translateY(12px); } }

/* ── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .pt-header { padding: 20px; }
    .pt-header__title { font-size: 20px; }
    .pt-header__icon  { font-size: 36px; }

    .pt-table thead { display: none; }
    .pt-table tbody tr {
        display: block; padding: 12px; border-bottom: 2px solid var(--pt-bg);
        position: relative;
    }
    .pt-table tbody td {
        display: flex; align-items: center; justify-content: space-between;
        padding: 6px 0; border-bottom: 1px solid var(--pt-bg);
        font-size: 13px;
    }
    .pt-table tbody td:last-child { border-bottom: none; }
    .pt-table tbody td::before {
        content: attr(data-label);
        font-weight: 600; color: var(--pt-dark); font-size: 12px;
        min-width: 80px;
    }
    .pt-td--idx { justify-content: center; }
    .pt-td--idx::before { display: none; }
}

@media (max-width: 480px) {
    .pt-wrap { padding: 20px 10px 30px; }
    .pt-nav { padding: 14px; }
    .pt-month-pill { font-size: 12px; padding: 6px 12px; }
}
