/* ═══════════════════════════════════════════════════════════════
   Avirona Masters PWA — Mobile-First Dark Theme
   ═══════════════════════════════════════════════════════════════ */

:root {
    --color-primary: #00d4ff;
    --color-secondary: #bd00ff;
    --color-success: #00ff88;
    --color-warning: #ffaa00;
    --color-error: #ff4466;

    --bg-primary: #0a0a0f;
    --bg-secondary: #0e0e18;
    --bg-card: rgba(20, 20, 35, 0.8);
    --bg-card-solid: #141423;
    --bg-input: rgba(10, 10, 20, 0.9);
    --bg-hover: rgba(0, 212, 255, 0.06);

    --text-primary: #e0e0e0;
    --text-secondary: #aaa;
    --text-muted: #666;
    --text-heading: #f0f0f0;

    --border-color: rgba(255, 255, 255, 0.06);
    --border-color-light: rgba(255, 255, 255, 0.1);

    --gradient-primary: linear-gradient(135deg, #00d4ff, #bd00ff);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(0, 212, 255, 0.1);

    --radius: 12px;
    --radius-sm: 8px;
    --nav-height: 60px;
    --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

/* ── Auth Page ────────────────────────────────────────────── */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 20px;
}

.auth-container {
    width: 100%;
    max-width: 400px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}
.logo-text {
    font-family: 'Orbitron', sans-serif;
    font-size: 32px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.logo-sub {
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 4px;
    text-transform: uppercase;
    margin-top: 4px;
}

.auth-form {
    display: none;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 24px;
    backdrop-filter: blur(10px);
}
.auth-form.active { display: block; }
.auth-form h2 {
    color: var(--text-heading);
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.tab-switch {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.tab-btn {
    flex: 1;
    padding: 10px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: 0.2s;
}
.tab-btn.active {
    background: rgba(0, 212, 255, 0.1);
    color: var(--color-primary);
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.input-group {
    margin-bottom: 16px;
}
.input-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 6px;
}
.input-group input,
.input-group select {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color-light);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 16px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    -webkit-appearance: none;
}
.input-group input:focus,
.input-group select:focus {
    border-color: var(--color-primary);
}
.input-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23aaa' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}

.specs-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.spec-chip {
    cursor: pointer;
}
.spec-chip input { display: none; }
.spec-chip span {
    display: inline-block;
    padding: 8px 14px;
    border: 1px solid var(--border-color-light);
    border-radius: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    transition: 0.2s;
}
.spec-chip input:checked + span {
    background: rgba(0, 212, 255, 0.15);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: var(--gradient-primary);
    border: none;
    border-radius: var(--radius-sm);
    color: #000;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 8px;
    transition: opacity 0.2s;
}
.btn-primary:active { opacity: 0.8; }
.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.auth-link {
    text-align: center;
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
}
.auth-link a {
    color: var(--color-primary);
    text-decoration: none;
}

.verify-text {
    color: var(--text-secondary);
    font-size: 14px;
    text-align: center;
    margin-bottom: 16px;
}

.error-message {
    display: none;
    background: rgba(255, 68, 102, 0.1);
    border: 1px solid rgba(255, 68, 102, 0.3);
    border-radius: var(--radius-sm);
    padding: 12px;
    color: var(--color-error);
    font-size: 14px;
    text-align: center;
    margin-top: 16px;
}

/* ═══════════════════════════════════════════════════════════════
   App Shell
   ═══════════════════════════════════════════════════════════════ */

.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(10, 10, 20, 0.9);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
}
.topbar-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 16px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.work-toggle {
    position: relative;
    width: 44px;
    height: 24px;
    cursor: pointer;
}
.work-toggle input { display: none; }
.work-toggle .slider {
    position: absolute;
    inset: 0;
    background: #333;
    border-radius: 12px;
    transition: 0.3s;
}
.work-toggle .slider::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: #888;
    border-radius: 50%;
    transition: 0.3s;
}
.work-toggle input:checked + .slider {
    background: rgba(0, 255, 136, 0.3);
}
.work-toggle input:checked + .slider::after {
    transform: translateX(20px);
    background: var(--color-success);
}

/* Main content */
.app-content {
    flex: 1;
    padding: 16px;
    padding-bottom: calc(var(--nav-height) + var(--safe-bottom) + 16px);
    max-width: 600px;
    margin: 0 auto;
    width: 100%;
}

/* Bottom navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: rgba(10, 10, 20, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    z-index: 100;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-decoration: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    transition: color 0.2s;
    position: relative;
    -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--color-primary); }
.nav-item svg {
    width: 22px;
    height: 22px;
    fill: currentColor;
}
.nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 18px);
    width: 8px;
    height: 8px;
    background: var(--color-error);
    border-radius: 50%;
}

/* ── Cards ────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    backdrop-filter: blur(10px);
}
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-heading);
}

/* ── Status badges ───────────────────────────────────── */

.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.badge-new { background: rgba(0, 212, 255, 0.15); color: var(--color-primary); }
.badge-accepted { background: rgba(0, 255, 136, 0.15); color: var(--color-success); }
.badge-in_progress { background: rgba(255, 170, 0, 0.15); color: var(--color-warning); }
.badge-completed { background: rgba(0, 255, 136, 0.15); color: var(--color-success); }
.badge-paid { background: rgba(189, 0, 255, 0.15); color: var(--color-secondary); }
.badge-cancelled { background: rgba(255, 68, 102, 0.15); color: var(--color-error); }

/* ── Order card ──────────────────────────────────────── */

.order-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
}
.order-spec {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
    text-transform: capitalize;
}
.order-city {
    font-size: 13px;
    color: var(--color-primary);
    margin-bottom: 8px;
}
.order-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.order-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.order-price {
    color: var(--color-success);
    font-weight: 600;
    font-size: 14px;
}
.order-actions {
    display: flex;
    gap: 8px;
}
.order-phone {
    color: var(--color-primary);
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 12px;
}
.order-phone a {
    color: inherit;
    text-decoration: none;
}

/* ── Buttons ─────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: 0.2s;
    font-family: inherit;
    min-height: 44px;
}
.btn-accept {
    flex: 1;
    background: rgba(0, 255, 136, 0.15);
    color: var(--color-success);
    border: 1px solid rgba(0, 255, 136, 0.3);
}
.btn-reject {
    flex: 1;
    background: rgba(255, 68, 102, 0.1);
    color: var(--color-error);
    border: 1px solid rgba(255, 68, 102, 0.2);
}
.btn-call {
    flex: 1;
    background: rgba(0, 212, 255, 0.15);
    color: var(--color-primary);
    border: 1px solid rgba(0, 212, 255, 0.3);
}
.btn-photo {
    background: rgba(189, 0, 255, 0.1);
    color: var(--color-secondary);
    border: 1px solid rgba(189, 0, 255, 0.2);
}
.btn-sm { padding: 8px 12px; font-size: 13px; min-height: 36px; }
.btn-block { width: 100%; }

/* ── Dashboard ───────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}
.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
}
.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 4px;
}
.stat-value.rating { color: var(--color-primary); }
.stat-value.orders { color: var(--color-success); }
.stat-value.pending { color: var(--color-warning); }
.stat-value.paid { color: var(--color-secondary); }
.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ── Section headers ─────────────────────────────────── */

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-color);
}
.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-heading);
}

/* ── Profile ─────────────────────────────────────────── */

.profile-header {
    text-align: center;
    padding: 24px 0;
}
.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--gradient-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    font-weight: 700;
    color: #000;
    margin: 0 auto 12px;
}
.profile-name {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
}
.profile-phone {
    font-size: 14px;
    color: var(--text-secondary);
}

.profile-menu {
    margin-top: 16px;
}
.profile-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 15px;
    transition: background 0.2s;
}
.profile-menu-item:active {
    background: var(--bg-hover);
}
.profile-menu-item .arrow {
    color: var(--text-muted);
}
.profile-menu-item.danger {
    color: var(--color-error);
}

/* ── Empty state ─────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    color: var(--text-muted);
}
.empty-state-icon {
    font-size: 48px;
    margin-bottom: 12px;
}
.empty-state-text {
    font-size: 15px;
}

/* ── Loading ─────────────────────────────────────────── */

.loading {
    text-align: center;
    padding: 32px;
    color: var(--text-muted);
}
.spinner {
    display: inline-block;
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color-light);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ───────────────────────────────────────────── */

.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    z-index: 1000;
    transition: transform 0.3s ease;
    max-width: 90%;
    text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.success { background: rgba(0, 255, 136, 0.9); color: #000; }
.toast.error { background: rgba(255, 68, 102, 0.9); color: #fff; }
.toast.info { background: rgba(0, 212, 255, 0.9); color: #000; }

/* ── Photos grid ─────────────────────────────────────── */

.photos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.photo-thumb {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
}
.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(255, 68, 102, 0.8);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ── Modal ───────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    width: 100%;
    max-width: 500px;
    background: var(--bg-card-solid);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 24px;
    padding-bottom: calc(24px + var(--safe-bottom));
    max-height: 80vh;
    overflow-y: auto;
}
.modal-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 16px;
}

/* ── Utilities ───────────────────────────────────────── */

.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 13px; }
.flex { display: flex; }
.gap-8 { gap: 8px; }
.hidden { display: none !important; }
