/* ============================================================
   ServicePro — Custom Styles
   Animations, transitions, bottom sheets, status colors, tap feedback
   ============================================================ */

/* ----- Reset & Base ----- */
*, *::before, *::after { box-sizing: border-box; }
body {
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overscroll-behavior-y: contain;
}

/* Disable text selection on UI chrome but allow in inputs */
.select-none { -webkit-user-select: none; user-select: none; }
input, textarea, [contenteditable] {
    -webkit-user-select: text !important;
    user-select: text !important;
}

/* ----- Safe area for bottom nav ----- */
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom, 0); }
.pb-safe { padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0)); }

/* ----- Bottom Navigation ----- */
.nav-item {
    display: flex; flex-direction: column; align-items: center;
    color: #9CA3AF; text-decoration: none; padding: 4px 12px;
    transition: color 0.15s;
}
.nav-item.active { color: var(--accent); }
.nav-item i { stroke-width: 1.8; }
.nav-fab {
    display: flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--accent); color: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin-top: -20px; text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}
.nav-fab:active { transform: scale(0.92); box-shadow: 0 2px 6px rgba(0,0,0,0.1); }

/* ----- Buttons ----- */
.btn-primary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 52px; padding: 14px 24px;
    background: var(--accent); color: white;
    border: none; border-radius: 16px;
    font-size: 16px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: transform 0.1s, opacity 0.15s;
}
.btn-primary:active { transform: scale(0.97); }
.btn-primary:disabled { opacity: 0.5; pointer-events: none; }

.btn-secondary {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 48px; padding: 12px 24px;
    background: white; color: var(--accent);
    border: 2px solid var(--accent); border-radius: 16px;
    font-size: 15px; font-weight: 600;
    cursor: pointer; text-decoration: none;
    transition: transform 0.1s;
}
.btn-secondary:active { transform: scale(0.97); }

.btn-danger {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; min-height: 48px; padding: 12px 24px;
    background: #FEE2E2; color: #DC2626;
    border: none; border-radius: 16px;
    font-size: 15px; font-weight: 600;
    cursor: pointer; transition: transform 0.1s;
}
.btn-danger:active { transform: scale(0.97); }

.btn-ghost {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 8px 16px; background: transparent; color: var(--accent);
    border: none; border-radius: 12px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: background 0.15s;
}
.btn-ghost:hover { background: rgba(0,0,0,0.04); }

/* ----- Cards ----- */
.card {
    background: white; border-radius: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    padding: 16px; margin-bottom: 12px;
    transition: transform 0.1s;
}
.card-tap:active { transform: scale(0.98); }

/* ----- Status Badges ----- */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 4px 12px; border-radius: 100px;
    font-size: 12px; font-weight: 600;
    white-space: nowrap;
}
.badge-received   { background: #FEF3C7; color: #92400E; }
.badge-in_progress { background: #DBEAFE; color: #1E40AF; }
.badge-ready      { background: #D1FAE5; color: #065F46; }
.badge-out_for_delivery { background: #EDE9FE; color: #5B21B6; }
.badge-completed  { background: #F3F4F6; color: #374151; }
.badge-cancelled  { background: #FEE2E2; color: #991B1B; }

.badge-paid    { background: #D1FAE5; color: #065F46; }
.badge-partial { background: #FEF3C7; color: #92400E; }
.badge-unpaid  { background: #FEE2E2; color: #991B1B; }

/* ----- Form Inputs ----- */
.form-group { margin-bottom: 16px; }
.form-label {
    display: block; font-size: 14px; font-weight: 500;
    color: #374151; margin-bottom: 6px;
}
.form-input {
    width: 100%; min-height: 48px; padding: 12px 16px;
    background: white; border: 2px solid #E5E7EB;
    border-radius: 12px; font-size: 16px; color: #111827;
    outline: none; transition: border-color 0.15s;
    font-family: 'DM Sans', sans-serif;
}
.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: #9CA3AF; }
.form-error { font-size: 13px; color: #DC2626; margin-top: 4px; }
.form-hint { font-size: 13px; color: #9CA3AF; margin-top: 4px; }

/* PIN input boxes */
.pin-container { display: flex; gap: 12px; justify-content: center; }
.pin-box {
    width: 56px; height: 64px; text-align: center;
    font-size: 24px; font-weight: 700;
    border: 2px solid #E5E7EB; border-radius: 12px;
    outline: none; transition: border-color 0.15s;
    -webkit-text-security: disc;
    font-family: 'DM Sans', sans-serif;
}
.pin-box:focus { border-color: var(--accent); }

/* ----- Search Input ----- */
.search-wrap {
    position: relative; margin-bottom: 16px;
}
.search-wrap i,
.search-wrap svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9CA3AF; pointer-events: none; z-index: 2; width: 20px; height: 20px; }
.search-input {
    width: 100%; min-height: 48px; padding: 12px 16px 12px 44px;
    background: white; border: 2px solid #E5E7EB;
    border-radius: 16px; font-size: 15px; color: #111827;
    outline: none; transition: border-color 0.15s;
    font-family: 'DM Sans', sans-serif;
}
.search-input:focus { border-color: var(--accent); }

/* ----- Bottom Sheet ----- */
#bottomSheet.open { transform: translateY(0); }
#sheetOverlay.open { opacity: 1; }

/* ----- Animations ----- */
@keyframes slideDown {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }

.animate-slideDown { animation: slideDown 0.3s ease-out; }
.animate-slideUp { animation: slideUp 0.3s ease-out; }
.animate-fadeIn { animation: fadeIn 0.2s ease-out; }
.animate-pulse { animation: pulse 2s infinite; }

/* ----- Skeleton loading ----- */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 8px;
}
@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ----- Quantity Controls ----- */
.qty-btn {
    display: flex; align-items: center; justify-content: center;
    width: 36px; height: 36px; border-radius: 10px;
    border: 2px solid #E5E7EB; background: white;
    font-size: 18px; font-weight: 700; color: #374151;
    cursor: pointer; transition: all 0.15s;
}
.qty-btn:active { transform: scale(0.9); }
.qty-btn.active { border-color: var(--accent); color: var(--accent); background: rgba(13,148,136,0.05); }

/* ----- Filter Tabs ----- */
.filter-tabs {
    display: flex; gap: 8px; overflow-x: auto;
    padding-bottom: 4px; margin-bottom: 16px;
    -ms-overflow-style: none; scrollbar-width: none;
}
.filter-tabs::-webkit-scrollbar { display: none; }
.filter-tab {
    flex-shrink: 0; padding: 8px 16px;
    border-radius: 100px; font-size: 13px; font-weight: 600;
    background: white; color: #6B7280; border: 1.5px solid #E5E7EB;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.filter-tab.active {
    background: var(--accent); color: white; border-color: var(--accent);
}

/* ----- Summary Cards ----- */
.summary-card {
    background: white; border-radius: 16px;
    padding: 16px; box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer; transition: transform 0.1s;
}
.summary-card:active { transform: scale(0.97); }
.summary-value {
    font-size: 28px; font-weight: 700; color: #111827;
    line-height: 1.2;
}
.summary-label {
    font-size: 13px; color: #6B7280; margin-top: 2px;
}

/* ----- Spinner ----- */
.spinner {
    width: 20px; height: 20px;
    border: 2.5px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    display: inline-block;
}
.spinner-dark {
    border-color: rgba(0,0,0,0.1);
    border-top-color: var(--accent);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ----- Toggle Switch ----- */
.toggle {
    position: relative; width: 48px; height: 28px;
    background: #E5E7EB; border-radius: 14px;
    cursor: pointer; transition: background 0.2s; flex-shrink: 0;
}
.toggle.active { background: var(--accent); }
.toggle::after {
    content: ''; position: absolute;
    top: 2px; left: 2px; width: 24px; height: 24px;
    background: white; border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
    transition: transform 0.2s;
}
.toggle.active::after { transform: translateX(20px); }

/* ----- Color Swatches ----- */
.color-swatch {
    width: 40px; height: 40px; border-radius: 50%;
    cursor: pointer; border: 3px solid transparent;
    transition: border-color 0.15s, transform 0.1s;
}
.color-swatch.active { border-color: #111827; transform: scale(1.1); }

/* ----- Section Header ----- */
.section-header {
    font-size: 13px; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.05em; color: #9CA3AF;
    padding: 16px 0 8px;
}

/* ----- Utility ----- */
.text-accent { color: var(--accent); }
.bg-accent { background: var(--accent); }
.border-accent { border-color: var(--accent); }
.line-through { text-decoration: line-through; }
.truncate-2 {
    display: -webkit-box; -webkit-line-clamp: 2;
    -webkit-box-orient: vertical; overflow: hidden;
}
