:root {
    --brand-navy: #001A72;
    --brand-teal: #00AF66;
    --sky-blue: #3B82F6;
    --white: #ffffff;
    --text-muted: #64748b;
    --text-main: #1A1A1B;
    --border-light: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.esim-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 0.8rem;
    padding: 0.6rem 0;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 19px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
}

/* Icon Box Styling with Tints */
.stat-icon-box {
    width: 46px;
    height: 46px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.navy-tint {
    background: #EEF2FF;
    color: var(--brand-navy);
}

.teal-tint {
    background: #ECFDF5;
    color: var(--brand-teal);
}

.orange-tint {
    background: #FFF7ED;
    color: #EA580C;
}

.red-tint {
    background: #FEF2F2;
    color: #DC2626;
}

/* Content Styling */
.stat-content {
    display: flex;
    flex-direction: column;
}

.stat-label {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    margin-bottom: 4px;
}

.stat-value-group {
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.stat-number {
    font-size: 1.6rem;
    font-weight: 800;
    /* Matching that extra bold look */
    color: var(--text-main);
    line-height: 1.1;
}

.stat-unit {
    font-size: 1rem;
    font-weight: 800;
    color: #94a3b8;
    /* Slightly lighter for the GB */
}

.stat-sub {
    font-size: 0.67rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-top: 4px;
}

/* Mobile Adjustments */
@media (max-width: 640px) {
    .esim-stats-row {
        grid-template-columns: 1fr;
    }

    .stat-card {
        padding: 20px;
    }
}

.esim-filter-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 1px 0;
    gap: 16px;
}

.filter-tabs {
    display: flex;
    align-items: center;
    background: var(--white);
    padding: 5px;
    border-radius: 160px;
    border: 1px solid var(--border-light);
    /* Premium touch: smooth scrolling on mobile */
    overflow-x: auto;
    scrollbar-width: none;
    /* Firefox */
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.filter-tabs::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 15px;
    border-radius: 160px;
    border: none;
    background: transparent;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s ease;
}

/* Active Tab: Brand Navy */
.tab-item.active {
    background: var(--brand-navy);
    color: var(--white);
}

/* Tab Counters */
.count {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    font-size: 0.7rem;
    border-radius: 10px;
    background: #eef2ff;
    color: var(--brand-navy);
}

.tab-item.active .count {
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
}

/* Desktop Action Buttons */
.filter-actions {
    display: flex;
    gap: 12px;
}

.action-outline {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 13px;
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}



/* 📱 Mobile Optimization */
@media (max-width: 768px) {
    .esim-filter-container {
        flex-direction: column;
        align-items: flex-start;
    }


    .filter-tabs {
        display: none;
    }

}




.esim-manage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
    padding: 10px 0;
}

.esim-card-pro {
    background: var(--white);
    border: 1px solid var(--border-light);
    border-radius: 20px;
    /* Slightly tighter radius */
    padding: 18px;
    /* Reduced from 24px */
    position: relative;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* HEADER ROW: Flag + Name + Status */
.card-row-top {
    display: flex;
    align-items: center;
    /* Perfect vertical center */
    gap: 12px;
    margin-bottom: 14px;
}

.flag-wrapper {
    width: 42px;
    /* Smaller flag */
    height: 42px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-light);
    flex-shrink: 0;
}

.flag-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.name-meta {
    flex: 1;
    min-width: 0;
}

.name-meta h3 {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--brand-navy);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.name-meta p {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.status-box {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* PILL STYLING: Dual Border Tech */
.status-pill-mini {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 100px;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    white-space: nowrap;
}

.status-pill-mini.connected {
    background: var(--brand-teal-soft);
    color: var(--brand-teal-dim);
    border: 1px solid rgba(0, 175, 102, 0.3);
}

.status-pill-mini .dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--brand-teal);
}

/* ─────────────────────────────────────────
   STATUS PILLS: READY & EXPIRED
───────────────────────────────────────── */

/* Ready State - Pending/Blue vibe */
.status-pill-mini.ready {
    background: #EFF6FF;
    /* Very light blue */
    color: #1E40AF;
    /* Deep blue */
    border: 1px solid rgba(30, 64, 175, 0.2);
}

.status-pill-mini.ready .dot {
    background: #3B82F6;
    /* Sky Blue */
    box-shadow: 0 0 6px rgba(59, 130, 246, 0.5);
}

/* Expired State - Danger/Red vibe */
.status-pill-mini.expired {
    background: #FEF2F2;
    /* Very light red */
    color: #991B1B;
    /* Deep red */
    border: 1px solid rgba(153, 27, 27, 0.2);
}

.status-pill-mini.expired .dot {
    background: #DC2626;
    /* Brand Red */
}

/* Optional: Add a subtle pulse to the "Connected" dot to show it's live */
.status-pill-mini.connected .dot {
    box-shadow: 0 0 0 0 rgba(0, 175, 102, 0.7);
    animation: pulse-green 2s infinite;
}

@keyframes pulse-green {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 175, 102, 0.7);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(0, 175, 102, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(0, 175, 102, 0);
    }
}

/* DATA SECTION: Tightening the GB display */
.data-compact-section {
    margin: 14px 0;
}

.data-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.data-main .val {
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: -1px;
}

.data-main .unit {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--text-main);
}

.total-label {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-muted);
}

.progress-bar-thin {
    height: 6px;
    /* Thinner bar */
    background: #f1f5f9;
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.bar-fill {
    height: 100%;
    border-radius: 20px;
}

.bar-fill.teal {
    background: var(--brand-teal);
}

.bar-fill.red {
    background: #EF4444;
}

.data-sub-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    margin-top: 6px;
}

/* ACTIONS: 2x2 Grid */
.action-grid-tight {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 14px;
}

.btn-sm-primary,
.btn-sm-outline {
    padding: 10px;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}

.plan-tag-compact {
    font-size: 0.75rem;
    color: var(--brand-teal);
    font-weight: 600;
}

.btn-sm-primary {
    background: var(--brand-teal);
    color: white;
    border: none;
}

.btn-sm-outline {
    background: white;
    border: 1px solid var(--border-light);
    color: var(--brand-navy);
}

.btn-sm-outline.danger {
    color: #DC2626;
    border-color: #FEE2E2;
}

.btn-sm-outline:hover {
    background: #F8FAFC;
    border-color: var(--brand-navy);
}

/* EXPIRY */
.expiry-row-slim {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    color: var(--text-muted);
    background: #F8FAFC;
    padding: 6px 12px;
    border-radius: 8px;
}

/* 📱 MOBILE OPTIMIZATION: Unified breakpoint */
@media (max-width: 640px) {

    /* Grid: Single column */
    .esim-manage-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    /* Filter container: Stack on mobile */
    .esim-filter-container {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Hide filter tabs on mobile */
    .filter-tabs {
        display: none;
    }

    /* Card optimizations for mobile */
    .esim-card-pro {
        padding: 17px;
        border-radius: 16px;
    }

    .card-row-top {
        gap: 10px;
        margin-bottom: 10px;
    }

    .flag-wrapper {
        width: 36px;
        height: 36px;
        border-radius: 8px;
    }

    .name-meta h3 {
        font-size: 0.85rem;
    }

    .status-pill-mini {
        padding: 2px 8px;
        font-size: 0.55rem;
    }

    /* Data section: Compact mode */
    .data-compact-section {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
        margin: 8px 0;
        padding: 8px;
        background: var(--chalk);
        border-radius: 10px;
    }

    .data-header {
        margin-bottom: 0;
        flex: 1;
    }

    .data-main .val {
        font-size: 1.2rem;
    }

    .progress-bar-thin {
        width: 100%;
        height: 4px;
        margin: 4px 0;
    }

    .data-sub-labels,
    .total-label {
        font-size: 0.6rem;
    }

    /* Actions: Single row */
    .action-grid-tight {
        grid-template-columns: repeat(4, 1fr);
        gap: 5px;
    }

    .btn-sm-primary,
    .btn-sm-outline {
        padding: 8px 4px;
        font-size: 0.6rem;
        flex-direction: column;
        gap: 2px;
        font-weight: 600;
    }

    .btn-sm-primary i,
    .btn-sm-outline i {
        font-size: 1rem;
    }
}

/* ─────────────────────────────────────────
   MODAL: GLOBAL & MOBILE-FIRST
───────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 26, 114, 0.4);
    /* Brand Navy with opacity */
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-end;
    /* Mobile: Bottom Sheet */
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal-container {
    background: var(--white);
    width: 100%;
    max-width: 500px;
    border-top-left-radius: 32px;
    border-top-right-radius: 32px;
    padding: 24px;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.active .modal-container {
    transform: translateY(0);
}

/* Header Styling */
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title-group {
    display: flex;
    gap: 14px;
    align-items: center;
}

.modal-title-group.centered {
    justify-content: center;
    width: 100%;
    flex-direction: column;
    text-align: center;
}

.modal-flag {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border-light);
}

.modal-flag img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 850;
    color: var(--brand-navy);
    margin-bottom: 2px;
}

.modal-header p {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 600;
}

.close-modal {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--chalk);
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
}

/* Status Strip */
.status-strip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.status-strip.connected {
    background: #ECFDF5;
    color: var(--brand-teal);
}

/* Info Grid */
.detail-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 24px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-item .label {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.info-item .val {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
}

/* Progress Card */
.modal-usage-card {
    background: var(--bg-main);
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 24px;
}

.usage-header {
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    font-size: 0.9rem;
    margin-bottom: 12px;
}

.modal-progress {
    height: 10px;
    background: #E2E8F0;
    border-radius: 10px;
    overflow: hidden;
}

.modal-progress-fill {
    height: 100%;
    background: var(--brand-navy);
    border-radius: 10px;
    transition: width 1s ease;
}

/* Footer */
.modal-footer {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.usage-footer {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    padding-top: 3px;
}

.btn-full {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    font-weight: 800;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    border: none;
}

.btn-full.primary {
    background: var(--brand-navy);
    color: white;
}

.btn-full.secondary {
    background: var(--white);
    border: 1px solid var(--border-light);
    color: var(--brand-navy);
}

/* 📱 MOBILE ADJUSTMENT: Smaller modal on small screens */
@media (max-width: 480px) {
    .modal-container {
        padding: 24px;
        max-height: 85vh;
        min-height: 40vh;
        overflow-y: auto;
    }

    .modal-header {
        margin-bottom: 16px;
    }

    .modal-header h2 {
        font-size: 1rem;
    }

    .modal-header p {
        font-size: 0.7rem;
    }

    .modal-flag {
        width: 36px;
        height: 36px;
        border-radius: 10px;
    }

    .close-modal {
        width: 32px;
        height: 32px;
        font-size: 1rem;
    }

    .status-strip {
        padding: 10px 12px;
        font-size: 0.75rem;
        margin-bottom: 16px;
    }

    .detail-info-grid {
        gap: 12px;
        margin-bottom: 16px;
    }

    .info-item .val {
        font-size: 0.8rem;
    }

    .modal-usage-card {
        padding: 16px;
        margin-bottom: 16px;
    }

    .usage-header {
        font-size: 0.85rem;
    }

    .btn-full {
        padding: 14px;
        font-size: 0.9rem;
    }
}

/* 💻 DESKTOP ADJUSTMENT */
@media (min-width: 769px) {
    .modal-overlay {
        align-items: center;
    }

    .modal-container {
        border-radius: 32px;
        transform: scale(0.9);
    }

    .modal-overlay.active .modal-container {
        transform: scale(1);
    }
}


.balance-mini-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--chalk);
    padding: 14px 18px;
    border-radius: 14px;
    margin-bottom: 24px;
}

.b-info span {
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--text-muted);
    text-transform: uppercase;
}

.b-info p {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--brand-navy);
}

.b-data span {
    font-size: 1rem;
    font-weight: 900;
    color: var(--brand-teal);
}

.select-wrapper {
    position: relative;
    width: 100%;
}

#planDropdown {
    width: 100%;
    padding: 14px 16px;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--brand-navy);
    background: var(--white);
    border: 2px solid var(--border-light);
    border-radius: 12px;
    appearance: none;
    /* Removes default browser arrow */
    cursor: pointer;
    transition: all 0.2s;
}

#planDropdown:focus {
    border-color: var(--brand-teal);
    outline: none;
    background: #f0fdf4;
}

.select-wrapper i {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--text-muted);
    font-size: 1.2rem;
}

.plan-preview-box {
    margin-top: 16px;
    padding: 16px;
    background: #f8fafc;
    border: 1px dashed var(--border-light);
    border-radius: 12px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.preview-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
}

.preview-row:last-child {
    margin-bottom: 0;
}

.p-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}

/* Notification component */
#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 2000;
}

.notification {
    min-width: 220px;
    max-width: 360px;
    padding: 12px 14px;
    border-radius: 12px;
    color: white;
    box-shadow: 0 8px 20px rgba(2, 6, 23, 0.2);
    transform: translateY(-8px);
    opacity: 0;
    transition: all 260ms ease;
    font-weight: 700;
}

.notification.visible {
    transform: translateY(0);
    opacity: 1;
}

.notification-body {
    font-size: 0.9rem;
}

.notification-info {
    background: rgba(59, 130, 246, 0.95);
}

.notification-success {
    background: rgba(16, 185, 129, 0.95);
}

.notification-error {
    background: rgba(239, 68, 68, 0.95);
}

.notification-warning {
    background: rgba(245, 158, 11, 0.95);
}

/* Type specific shortcuts */
.notification.notification-info {
    background: #3B82F6;
}

.notification.notification-success {
    background: #10B981;
}

.notification.notification-error {
    background: #EF4444;
}

.notification.notification-warning {
    background: #F59E0B;
}

/* Delete modal / danger icon */
.icon-circle.danger {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #FEF2F2;
    color: #991B1B;
    font-size: 1.1rem;
    border: 1px solid rgba(153, 27, 27, 0.08);
}

.modal-container.delete-variant .modal-header h2 {
    color: #991B1B;
}

/* Delete Specific Styles */
.modal-container.delete-variant {
    max-width: 420px;
    /* Slightly slimmer for urgency */
}

.icon-circle.danger-light {
    width: 44px;
    height: 44px;
    background: #FEF2F2;
    color: #EF4444;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.danger-alert-box {
    display: flex;
    gap: 12px;
    background: #FFF5F5;
    border: 1px solid #FEE2E2;
    padding: 16px;
    border-radius: 16px;
    margin-bottom: 8px;
}

.danger-alert-box i {
    color: #DC2626;
    font-size: 1.2rem;
    margin-top: 2px;
}

.alert-content strong {
    display: block;
    color: #991B1B;
    font-size: 0.9rem;
    font-weight: 800;
    margin-bottom: 4px;
}

.alert-content p {
    font-size: 0.8rem;
    line-height: 1.4;
    color: #7F1D1D;
    opacity: 0.8;
}

.footer-grid-dual {
    display: grid;
    grid-template-columns: 1fr 1.5fr;
    /* Give the "Delete" button more weight */
    gap: 12px;
}

.btn-full.danger-solid {
    background: #EF4444;
    color: white;
    border: none;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.2);
}

.btn-full.danger-solid:hover {
    background: #DC2626;
}