/* ═══════════════════════════════════════════════════════
   LuizaGoods — iOS Design System
   Premium glassmorphism design with smooth animations
   ═══════════════════════════════════════════════════════ */

/* ── Reset & Base ─────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Color Palette — iOS-inspired */
    --bg-primary: #f2f2f7;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e5e5ea;
    --bg-grouped: #f2f2f7;

    --text-primary: #1c1c1e;
    --text-secondary: #8e8e93;
    --text-tertiary: #aeaeb2;

    --accent: #007aff;
    --accent-light: rgba(0, 122, 255, 0.12);
    --accent-gradient: linear-gradient(135deg, #007aff 0%, #5856d6 100%);

    --green: #34c759;
    --green-light: rgba(52, 199, 89, 0.12);
    --orange: #ff9500;
    --orange-light: rgba(255, 149, 0, 0.12);
    --red: #ff3b30;
    --red-light: rgba(255, 59, 48, 0.12);
    --yellow: #ffcc00;
    --indigo: #5856d6;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
    --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.06);

    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;

    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;

    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* ── Dark Mode ────────────────────────────────────────── */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #000000;
        --bg-secondary: #1c1c1e;
        --bg-tertiary: #2c2c2e;
        --bg-grouped: #000000;

        --text-primary: #ffffff;
        --text-secondary: #98989d;
        --text-tertiary: #636366;

        --accent-light: rgba(0, 122, 255, 0.2);
        --green-light: rgba(52, 199, 89, 0.2);
        --orange-light: rgba(255, 149, 0, 0.2);
        --red-light: rgba(255, 59, 48, 0.2);

        --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
        --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
        --shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
        --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
    }
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

#app {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100vh;
    position: relative;
    background: var(--bg-grouped);
}

/* ── Status Bar ───────────────────────────────────────── */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 24px 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    padding-top: calc(12px + var(--safe-top));
}

.status-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-primary);
}

.battery {
    width: 24px;
    height: 11px;
    border: 1.5px solid var(--text-primary);
    border-radius: 3px;
    padding: 1px;
    position: relative;
}

.battery::after {
    content: '';
    position: absolute;
    right: -4px;
    top: 2px;
    width: 2px;
    height: 5px;
    background: var(--text-primary);
    border-radius: 0 1px 1px 0;
}

.battery-fill {
    width: 80%;
    height: 100%;
    background: var(--green);
    border-radius: 1px;
}

/* ── Header ───────────────────────────────────────────── */
.header {
    padding: 8px 20px 20px;
}

.header-content {
    padding: 24px;
    background: var(--accent-gradient);
    border-radius: var(--radius-lg);
    position: relative;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 122, 255, 0.25);
}

.header-content::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -10%;
    width: 200px;
    height: 200px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.header-content::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -5%;
    width: 150px;
    height: 150px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 50%;
}

.header-title {
    font-size: 32px;
    font-weight: 800;
    color: #ffffff;
    letter-spacing: -0.5px;
    position: relative;
    z-index: 1;
}

.header-subtitle {
    font-size: 15px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 4px;
    position: relative;
    z-index: 1;
}

/* ── Navigation Tiles ─────────────────────────────────── */
.nav-tiles {
    padding: 0 20px 12px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.nav-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: var(--bg-secondary);
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
    text-align: left;
    -webkit-tap-highlight-color: transparent;
}

.nav-tile::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--accent-light);
    opacity: 0;
    transition: opacity 0.25s ease;
}

.nav-tile:active {
    transform: scale(0.97);
}

.nav-tile.active::before {
    opacity: 1;
}

.nav-tile-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-sm);
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 122, 255, 0.3);
}

.nav-tile-label {
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.nav-tile-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 7px;
    border-radius: 11px;
    background: var(--red);
    color: white;
    font-size: 13px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Sections ─────────────────────────────────────────── */
.section {
    padding: 0 20px 100px;
    animation: fadeInUp 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ── Sync Button ──────────────────────────────────────── */
.sync-button {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    -webkit-tap-highlight-color: transparent;
    margin-bottom: 12px;
}

.sync-button:hover {
    background: var(--accent);
    box-shadow: 0 6px 24px rgba(0, 122, 255, 0.35);
}

.sync-button:hover .sync-button-text,
.sync-button:hover .sync-button-icon {
    color: #fff;
}

.sync-button:active {
    transform: scale(0.97);
}

.sync-button.loading {
    background: var(--accent);
    border-color: var(--accent);
    pointer-events: none;
}

.sync-button.loading .sync-button-text,
.sync-button.loading .sync-button-icon {
    color: #fff;
}

.sync-button.loading .sync-button-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

.sync-button-icon {
    color: var(--accent);
    display: flex;
    align-items: center;
    transition: color 0.3s ease;
}

.sync-button-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent);
    font-family: var(--font);
    transition: color 0.3s ease;
}

/* ── Sync Info ────────────────────────────────────────── */
.sync-info {
    text-align: center;
    font-size: 13px;
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

/* ── Empty State ──────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    animation: fadeInUp 0.5s ease;
}

.empty-state-icon {
    font-size: 56px;
    margin-bottom: 16px;
    filter: grayscale(0.2);
}

.empty-state h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 15px;
    color: var(--text-secondary);
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto;
}

/* ── Delivery List ────────────────────────────────────── */
.delivery-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ── Delivery Card ────────────────────────────────────── */
.delivery-card {
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    animation: cardSlideIn 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both;
    -webkit-tap-highlight-color: transparent;
}

.delivery-card:active {
    transform: scale(0.98);
}

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.delivery-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 0;
}

.delivery-carrier {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.delivery-status {
    font-size: 12px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.delivery-status.in-transit {
    background: var(--orange-light);
    color: var(--orange);
}

.delivery-status.delivered {
    background: var(--green-light);
    color: var(--green);
}

.delivery-status.pending {
    background: var(--accent-light);
    color: var(--accent);
}

.delivery-status.waiting {
    background: var(--accent-light);
    color: var(--indigo);
}

.delivery-status.refunded {
    background: var(--red-light);
    color: var(--red);
}

.delivery-card-body {
    display: flex;
    gap: 14px;
    padding: 12px 16px;
}

.delivery-image {
    width: 64px;
    height: 64px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-tertiary);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    color: var(--text-tertiary);
}

.delivery-image img {
    width: 100%;
    height: 100%;
    border-radius: var(--radius-sm);
    object-fit: cover;
}

.delivery-info {
    flex: 1;
    min-width: 0;
}

.delivery-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 6px;
}

.delivery-price {
    font-size: 17px;
    font-weight: 700;
    color: var(--red);
}

.delivery-price-currency {
    font-size: 13px;
    font-weight: 600;
}

.delivery-card-footer {
    padding: 10px 16px 14px;
    border-top: 1px solid var(--bg-tertiary);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.delivery-tracking {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.delivery-tracking-label {
    color: var(--text-tertiary);
}

.delivery-tracking-number {
    color: var(--accent);
    font-weight: 600;
    font-family: 'SF Mono', 'Fira Code', monospace;
    letter-spacing: 0.5px;
}

.delivery-status-text {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ── Toast ─────────────────────────────────────────────── */
.toast {
    position: fixed;
    bottom: -100px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 14px 24px;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    z-index: 1000;
    transition: bottom 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    white-space: nowrap;
    max-width: calc(100% - 40px);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.toast.show {
    bottom: calc(32px + var(--safe-bottom));
}

.toast-icon {
    font-size: 18px;
}

.toast-text {
    color: var(--text-primary);
}

/* ── Skeleton Loading ──────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-tertiary) 25%,
            var(--bg-secondary) 50%,
            var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.8s infinite ease-in-out;
    border-radius: var(--radius-sm);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-card {
    height: 140px;
    border-radius: var(--radius-md);
    margin-bottom: 12px;
}

/* ── QR Auth Modal ─────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--bg-secondary);
    width: 320px;
    border-radius: var(--radius-xl);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    text-align: center;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 30px;
    height: 30px;
    border-radius: 15px;
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.modal-close:hover {
    background: var(--bg-primary);
    color: var(--text-primary);
}

.modal-header {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
    margin-top: 8px;
}

.modal-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.qr-container {
    width: 200px;
    height: 200px;
    margin: 0 auto 16px;
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.qr-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    mix-blend-mode: multiply;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    position: absolute;
}

.modal-hint {
    font-size: 13px;
    color: var(--text-tertiary);
    line-height: 1.4;
    padding: 0 10px;
}

/* ── Responsive ────────────────────────────────────────── */
@media (min-width: 431px) {
    #app {
        border-left: 1px solid var(--bg-tertiary);
        border-right: 1px solid var(--bg-tertiary);
        box-shadow: 0 0 60px rgba(0, 0, 0, 0.08);
    }
}

/* ── Scrollbar ─────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 0;
    background: transparent;
}