/* ============================================
   رهگیر - استایل اصلی
   ============================================ */

:root {
    --primary: #7c3aed;
    --primary-light: #a78bfa;
    --primary-dark: #5b21b6;
    --secondary: #06b6d4;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --dark: #1e1b4b;
    --darker: #0f0a2e;
    --light: #f5f3ff;
    --white: #ffffff;
    --gray: #64748b;
    --gray-light: #e2e8f0;
    --gradient: linear-gradient(135deg, #7c3aed 0%, #06b6d4 100%);
    --gradient-2: linear-gradient(135deg, #a78bfa 0%, #22d3ee 100%);
    --gradient-warm: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    --shadow-sm: 0 2px 10px rgba(124, 58, 237, 0.08);
    --shadow: 0 10px 30px rgba(124, 58, 237, 0.15);
    --shadow-lg: 0 20px 50px rgba(124, 58, 237, 0.25);
    --radius: 24px;
    --radius-md: 18px;
    --radius-sm: 14px;
    --radius-xs: 10px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #f5f3ff;
    color: var(--dark);
    line-height: 1.7;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: none;
}

/* ===== Animated Gradient Background ===== */
.bg-gradient {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: linear-gradient(180deg, #ede9fe 0%, #f5f3ff 40%, #ecfeff 100%);
}

.bg-blob {
    position: fixed;
    border-radius: 50%;
    filter: blur(60px);
    z-index: -1;
    opacity: 0.5;
    pointer-events: none;
}

.bg-blob.blob-1 {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, #a78bfa, transparent 70%);
    top: -100px;
    right: -100px;
    animation: floatBlob 12s ease-in-out infinite;
}

.bg-blob.blob-2 {
    width: 250px;
    height: 250px;
    background: radial-gradient(circle, #22d3ee, transparent 70%);
    bottom: 100px;
    left: -100px;
    animation: floatBlob 15s ease-in-out infinite reverse;
}

.bg-blob.blob-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, #fbbf24, transparent 70%);
    top: 40%;
    left: 50%;
    animation: floatBlob 18s ease-in-out infinite;
    opacity: 0.3;
}

@keyframes floatBlob {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.1); }
    66% { transform: translate(-20px, 20px) scale(0.95); }
}

/* ===== App Shell ===== */
.app-shell {
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    position: relative;
    padding-bottom: 90px;
}

/* ===== App Header ===== */
.app-header {
    padding: 20px 20px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(180deg, rgba(245, 243, 255, 0.95) 0%, rgba(245, 243, 255, 0.7) 70%, transparent 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.header-logo {
    width: 44px;
    height: 44px;
    background: var(--gradient);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.35);
    position: relative;
    overflow: hidden;
}

.header-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.header-text h1 {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-text p {
    font-size: 0.7rem;
    color: var(--gray);
    font-weight: 500;
}

.header-action {
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
}

.header-action:active {
    transform: scale(0.92);
}

.header-action .notification-dot {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

/* ===== Main Content ===== */
.app-main {
    flex: 1;
    padding: 8px 20px 20px;
}

/* ===== Pages ===== */
.page {
    display: none;
    animation: pageFade 0.4s ease;
}

.page.active {
    display: block;
}

@keyframes pageFade {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Welcome Banner ===== */
.welcome-banner {
    background: var(--gradient);
    border-radius: var(--radius);
    padding: 24px;
    color: white;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.welcome-banner::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -80px;
    left: -60px;
}

.welcome-banner::after {
    content: '📦';
    position: absolute;
    font-size: 5rem;
    opacity: 0.15;
    top: 10px;
    left: 10px;
    transform: rotate(-15deg);
}

.welcome-banner h2 {
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 6px;
    position: relative;
    z-index: 1;
}

.welcome-banner p {
    font-size: 0.8rem;
    opacity: 0.9;
    position: relative;
    z-index: 1;
    max-width: 80%;
}

.welcome-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    padding: 5px 12px;
    border-radius: 100px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 12px;
    position: relative;
    z-index: 1;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.welcome-badge .pulse-dot {
    width: 7px;
    height: 7px;
    background: #4ade80;
    border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
    animation: ripple 2s infinite;
}

@keyframes ripple {
    0% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
    70% { box-shadow: 0 0 0 8px rgba(74, 222, 128, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

/* ===== Page Header ===== */
.page-header {
    padding: 20px 4px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-header .ph-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
    flex-shrink: 0;
}

.page-header h2 {
    font-size: 1.15rem;
    font-weight: 800;
    line-height: 1.2;
}

.page-header p {
    font-size: 0.72rem;
    color: var(--gray);
    margin-top: 2px;
}

/* ===== Tracking Card ===== */
.tracking-card {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
}

.tracking-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    left: 0;
    height: 4px;
    background: var(--gradient);
}

/* ===== Courier Tabs ===== */
.courier-tabs {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 18px;
    padding: 4px;
    background: var(--light);
    border-radius: var(--radius-sm);
}

.courier-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 12px 4px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--gray);
    border: 2px solid transparent;
    background: transparent;
    font-family: inherit;
}

.courier-tab .tab-icon {
    width: 36px;
    height: 36px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.courier-tab.active {
    background: white;
    color: var(--primary);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.15);
}

.courier-tab.active .tab-icon {
    transform: scale(1.05);
}

/* ===== Courier Images ===== */
.courier-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    pointer-events: none;
    margin: 0 auto;
}

.courier-img-redirect {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

/* تنظیم اندازه تصویر در تب‌های اپراتور */
.tab-icon .courier-img {
    width: 100%;
    height: 100%;
}

/* تنظیم اندازه تصویر در تاریخچه */
.history-icon .courier-img {
    width: 100%;
    height: 100%;
}

/* ===== Form Input ===== */
.input-wrapper {
    position: relative;
    margin-bottom: 16px;
}

.input-label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--dark);
    padding-right: 4px;
}

.input-field {
    width: 100%;
    padding: 16px 50px 16px 18px;
    border: 2px solid var(--gray-light);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.3s ease;
    background: white;
    color: var(--dark);
    text-align: center;
    letter-spacing: 2px;
    direction: ltr;
}

.input-field:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(124, 58, 237, 0.1);
    background: white;
}

.input-field::placeholder {
    color: #cbd5e1;
    letter-spacing: 1px;
    font-weight: 400;
}

.input-icon {
    position: absolute;
    right: 16px;
    top: 68%;
    transform: translateY(-50%);
    font-size: 1.1rem;
    opacity: 0.5;
    pointer-events: none;
}

/* ===== Submit Button ===== */
.btn-submit {
    width: 100%;
    padding: 16px 24px;
    border: none;
    border-radius: var(--radius-sm);
    background: var(--gradient);
    color: white;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 10px 25px rgba(124, 58, 237, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-submit::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.3) 50%, transparent 60%);
    animation: shine 2.5s infinite;
}

.btn-submit:active {
    transform: scale(0.97);
    box-shadow: 0 6px 15px rgba(124, 58, 237, 0.25);
}

.btn-submit:disabled {
    opacity: 0.7;
    pointer-events: none;
}

/* ===== History List ===== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.history-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}

.history-item:active {
    transform: scale(0.98);
    background: var(--light);
}

.history-icon {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    color: white;
    position: relative;
    overflow: hidden;
    background: transparent;
}

.history-info {
    flex: 1;
    min-width: 0;
}

.history-code {
    font-weight: 700;
    font-size: 0.9rem;
    direction: ltr;
    text-align: right;
    color: var(--dark);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    letter-spacing: 1px;
}

.history-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.7rem;
    color: var(--gray);
    margin-top: 4px;
}

.history-courier-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 100px;
    background: var(--light);
    font-weight: 600;
    font-size: 0.65rem;
}

.history-time {
    font-size: 0.65rem;
    color: var(--gray);
}

.history-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.history-btn {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: none;
    background: var(--light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    color: var(--gray);
}

.history-btn:hover {
    background: var(--primary);
    color: white;
}

.history-btn.delete:hover {
    background: var(--danger);
}

/* ===== History Toolbar ===== */
.history-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 4px;
    margin-bottom: 4px;
}

.history-count {
    font-size: 0.75rem;
    color: var(--gray);
    font-weight: 600;
}

.clear-all-btn {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
    border: none;
    padding: 8px 14px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
}

.clear-all-btn:active {
    transform: scale(0.95);
    background: rgba(239, 68, 68, 0.2);
}

/* ===== Empty State ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--gray);
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    border: 2px dashed var(--gray-light);
}

.empty-state .empty-icon {
    font-size: 3.5rem;
    margin-bottom: 12px;
    opacity: 0.6;
}

.empty-state h3 {
    font-size: 1rem;
    color: var(--dark);
    margin-bottom: 6px;
    font-weight: 700;
}

.empty-state p {
    font-size: 0.8rem;
    line-height: 1.7;
}

.empty-cta {
    display: inline-block;
    margin-top: 16px;
    padding: 10px 20px;
    background: var(--gradient);
    color: white;
    border-radius: 12px;
    text-decoration: none;
    font-size: 0.8rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

/* ===== Profile Page ===== */
.profile-hero {
    background: var(--gradient);
    border-radius: var(--radius);
    padding: 28px 20px;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.profile-hero::before {
    content: '';
    position: absolute;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    top: -100px;
    right: -80px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    margin: 0 auto 12px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    z-index: 1;
}

.profile-hero h2 {
    font-size: 1.1rem;
    font-weight: 800;
    position: relative;
    z-index: 1;
}

.profile-hero p {
    font-size: 0.75rem;
    opacity: 0.8;
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 20px;
    position: relative;
    z-index: 1;
}

.profile-stat {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 10px 6px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.profile-stat .ps-num {
    font-size: 1.1rem;
    font-weight: 800;
}

.profile-stat .ps-label {
    font-size: 0.62rem;
    opacity: 0.85;
    margin-top: 2px;
}

.settings-group {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 16px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: var(--shadow-sm);
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    border-bottom: 1px solid var(--gray-light);
    cursor: pointer;
    transition: background 0.2s ease;
    background: transparent;
    border-left: none;
    border-right: none;
    border-top: none;
    width: 100%;
    font-family: inherit;
    text-align: right;
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item:active {
    background: var(--light);
}

.settings-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    flex-shrink: 0;
    background: var(--light);
}

.settings-text {
    flex: 1;
}

.settings-text .st-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--dark);
}

.settings-text .st-sub {
    font-size: 0.7rem;
    color: var(--gray);
    margin-top: 2px;
}

.settings-arrow {
    color: var(--gray);
    font-size: 0.9rem;
}

/* ===== Bottom Navigation ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(124, 58, 237, 0.08);
    z-index: 500;
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -10px 30px rgba(124, 58, 237, 0.08);
}

.bottom-nav-inner {
    max-width: 500px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 4px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--gray);
    text-decoration: none;
    font-family: inherit;
    font-size: 0.65rem;
    font-weight: 600;
    border-radius: var(--radius-xs);
    transition: all 0.3s ease;
    position: relative;
}

.nav-item .nav-icon {
    font-size: 1.3rem;
    transition: transform 0.3s ease;
}

.nav-item.active {
    color: var(--primary);
}

.nav-item.active .nav-icon {
    transform: translateY(-2px) scale(1.1);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    right: 50%;
    transform: translateX(50%);
    width: 24px;
    height: 3px;
    background: var(--gradient);
    border-radius: 0 0 10px 10px;
}

.nav-item:active .nav-icon {
    transform: scale(0.9);
}

.nav-badge {
    position: absolute;
    top: 4px;
    right: 50%;
    transform: translateX(16px);
    background: var(--danger);
    color: white;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 100px;
    min-width: 16px;
    text-align: center;
}

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    left: 20px;
    max-width: 400px;
    margin: 0 auto;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    background: var(--dark);
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    z-index: 2000;
    transform: translateY(-150%);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
}

.toast.active {
    transform: translateY(0);
}

.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* ===== Install Banner ===== */
.install-banner {
    display: none;
    position: fixed;
    bottom: 90px;
    right: 16px;
    left: 16px;
    max-width: 460px;
    margin: 0 auto;
    background: var(--dark);
    color: white;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    z-index: 600;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    animation: slideUpBanner 0.4s ease;
}

.install-banner.active {
    display: flex;
}

@keyframes slideUpBanner {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.install-banner .ib-text {
    font-size: 0.8rem;
    font-weight: 700;
}

.install-banner .ib-sub {
    font-size: 0.65rem;
    opacity: 0.7;
    margin-top: 2px;
}

.install-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.install-btn {
    background: var(--gradient);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.install-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 4px;
}

/* ===== Iframe Fullscreen Overlay ===== */
.iframe-overlay {
    position: fixed;
    inset: 0;
    background: white;
    z-index: 4000;
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.iframe-overlay.active {
    opacity: 1;
    visibility: visible;
}

.iframe-header {
    height: 56px;
    background: var(--gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    z-index: 10;
}

.iframe-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 700;
}

.iframe-title-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    flex-shrink: 0;
}

.iframe-title-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 2px;
}

.iframe-close {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-family: inherit;
    flex-shrink: 0;
}

.iframe-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.iframe-close:active {
    transform: scale(0.95);
}

.iframe-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #f8fafc;
}

.tracking-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
    background: white;
}

/* ===== Iframe Loading ===== */
.iframe-loading {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: #f5f3ff;
    z-index: 5;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.iframe-loading.hidden {
    opacity: 0;
    visibility: hidden;
}

.iframe-loading p {
    color: var(--gray);
    font-size: 0.9rem;
    font-weight: 600;
}

.iframe-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-light);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== Responsive ===== */
@media (min-width: 480px) {
    .app-header { padding: 24px 24px 8px; }
    .app-main { padding: 8px 24px 20px; }
    .bottom-nav { padding: 8px 20px calc(8px + env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
    .courier-tab { font-size: 0.6rem; padding: 10px 2px; }
    .courier-tab .tab-icon { width: 30px; height: 30px; font-size: 0.95rem; }
    
    .iframe-header {
        height: 52px;
        padding: 0 12px;
    }
    
    .iframe-title {
        font-size: 0.8rem;
    }
    
    .iframe-close {
        width: 36px;
        height: 36px;
        font-size: 1rem;
    }
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-light); border-radius: 10px; }

/* ===== حذف پس‌زمینه گرادیانی اپراتورها ===== */
.tab-post, .tab-tipax, .tab-mahex, .tab-chapar {
    background: transparent !important;
}