/* TrackServe Offline-First & Sync Styling */

/* Topbar Network Pill */
.network-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
    user-select: none;
}

.network-status-pill.online {
    background: rgba(23, 154, 91, 0.18);
    color: #e4f7ec;
    border-color: rgba(23, 154, 91, 0.4);
}

.network-status-pill.online:hover {
    background: rgba(23, 154, 91, 0.28);
    border-color: rgba(23, 154, 91, 0.6);
}

.network-status-pill.offline {
    background: rgba(229, 138, 0, 0.22);
    color: #fff1d9;
    border-color: rgba(229, 138, 0, 0.5);
    animation: offlinePulse 2.5s infinite ease-in-out;
}

.network-status-pill.offline:hover {
    background: rgba(229, 138, 0, 0.35);
}

.network-status-pill.syncing {
    background: rgba(11, 77, 184, 0.3);
    color: #e7f0ff;
    border-color: rgba(147, 197, 253, 0.5);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: #10b981;
    box-shadow: 0 0 8px #10b981;
}

.status-dot.offline {
    background: #f59e0b;
    box-shadow: 0 0 8px #f59e0b;
}

.status-dot.syncing {
    background: #38bdf8;
    box-shadow: 0 0 8px #38bdf8;
    animation: spinDot 1s linear infinite;
}

.pending-badge {
    background: #ef4444;
    color: white;
    font-size: 9px;
    font-weight: 800;
    padding: 1px 5px;
    border-radius: 8px;
    margin-left: 2px;
}

@keyframes offlinePulse {
    0%, 100% { box-shadow: 0 0 0 rgba(229, 138, 0, 0); }
    50% { box-shadow: 0 0 10px rgba(229, 138, 0, 0.4); }
}

@keyframes spinDot {
    0% { transform: scale(0.8); opacity: 0.6; }
    50% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(0.8); opacity: 0.6; }
}

/* Offline Banner in Page Container */
.offline-mode-banner {
    background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
    border: 1px solid #fde68a;
    border-left: 4px solid #f59e0b;
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 2px 6px rgba(245, 158, 11, 0.08);
}

.offline-banner-content {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #92400e;
    font-size: 13px;
}

.offline-banner-content strong {
    font-weight: 700;
    color: #78350f;
}

/* Offline Pending Record Indicator */
.offline-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #fff7ed;
    color: #c2410c;
    border: 1px solid #ffedd5;
    font-size: 10.5px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
}

/* Modal Overlay & Drawer */
.sync-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.65);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    animation: fadeIn 0.2s ease-out;
}

.sync-modal {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.2);
    width: min(480px, 95vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.sync-modal-header {
    background: linear-gradient(135deg, #0b4db8 0%, #1e6bd6 100%);
    color: white;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sync-modal-header h2 {
    margin: 0;
    font-size: 14px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-modal-header p {
    margin: 1px 0 0 0;
    font-size: 10px;
    opacity: 0.85;
}

.modal-close-btn {
    background: rgba(255, 255, 255, 0.15);
    border: 0;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s ease;
}

.modal-close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

.sync-modal-body {
    padding: 12px 14px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Status Summary Box */
.sync-status-card {
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.sync-status-card.online {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
}

.sync-status-card.offline {
    background: #fffbeb;
    border: 1px solid #fde68a;
}

.sync-status-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sync-status-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: grid;
    place-items: center;
    font-size: 14px;
}

.sync-status-card.online .sync-status-icon {
    background: #dcfce7;
    color: #15803d;
}

.sync-status-card.offline .sync-status-icon {
    background: #fef3c7;
    color: #b45309;
}

.sync-status-title {
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 1px;
}

.sync-status-sub {
    font-size: 10px;
    color: #64748b;
}

/* Cache Metrics Grid */
.cache-metrics-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.cache-metric {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
}

.cache-metric-label {
    font-size: 9px;
    font-weight: 700;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.cache-metric-val {
    font-size: 15px;
    font-weight: 800;
    color: #1e293b;
    margin-top: 1px;
}

/* Outbox List */
.outbox-section {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 10px;
    background: #ffffff;
}

.outbox-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 11px;
    font-weight: 700;
    color: #334155;
}

.outbox-list {
    display: flex;
    flex-direction: column;
    gap: 5px;
    max-height: 100px;
    overflow-y: auto;
}

.outbox-item {
    background: #f8fafc;
    border: 1px solid #eef2f6;
    border-radius: 5px;
    padding: 5px 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    font-size: 10.5px;
}

.outbox-item-info {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #1e293b;
}

.outbox-item-time {
    font-size: 9px;
    color: #94a3b8;
    white-space: nowrap;
}

.outbox-empty {
    text-align: center;
    padding: 10px 6px;
    color: #94a3b8;
    font-size: 10.5px;
}

.sync-modal-footer {
    padding: 8px 14px;
    background: #f8fafc;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 6px;
}

/* Offline Login Card Enhancement */
.offline-login-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #fef3c7;
    color: #92400e;
    border: 1px solid #fde68a;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 800;
    margin-bottom: 14px;
}

.cached-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.cached-account-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: white;
    cursor: pointer;
    transition: all 0.15s ease;
}

.cached-account-pill:hover {
    border-color: #0b4db8;
    background: #f0f7ff;
}

.cached-account-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #0b4db8;
    color: white;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 12px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(18px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Unsynced Updates Notification Button & Dropdown */
.sync-notification-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.sync-notification-btn {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.22);
    color: white;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    position: relative;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s ease;
}

.sync-notification-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-1px);
}

.sync-notification-btn.has-unsynced {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.6);
}

.sync-notification-btn.has-unsynced:hover {
    background: rgba(239, 68, 68, 0.32);
}

.sync-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #ffffff;
    font-size: 9.5px;
    font-weight: 800;
    min-width: 17px;
    height: 17px;
    border-radius: 999px;
    display: grid;
    place-items: center;
    padding: 0 4px;
    border: 2px solid var(--primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    animation: badgePulse 2s infinite ease-in-out;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.12); }
}

.sync-notification-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: -10px;
    width: 320px;
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22);
    border: 1px solid #e2e8f0;
    z-index: 1050;
    overflow: hidden;
    color: #1e293b;
    animation: dropdownPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownPop {
    from { opacity: 0; transform: translateY(-8px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.sync-dropdown-header {
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sync-dropdown-title {
    font-size: 13px;
    font-weight: 800;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}

.sync-dropdown-list {
    max-height: 220px;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sync-dropdown-item {
    background: #f8fafc;
    border: 1px solid #f1f5f9;
    border-radius: 8px;
    padding: 8px 10px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: 11.5px;
    transition: background 0.15s ease;
}

.sync-dropdown-item:hover {
    background: #f1f5f9;
}

.sync-dropdown-empty {
    padding: 24px 16px;
    text-align: center;
    color: #64748b;
    font-size: 12px;
}

.sync-dropdown-footer {
    padding: 10px 14px;
    background: #f8fafc;
    border-top: 1px solid #edf2f7;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

