/* SpeedAssureERP — Global Styles */
:root {
    --primary: #7c3aed;
    --primary-dark: #6d28d9;
    --primary-light: #ede9fe;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #0ea5e9;
    --bg: #f9fafb;
    --card: #ffffff;
    --sidebar: #111827;
    --text: #111827;
    --muted: #6b7280;
    --border: #e5e7eb;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── LAYOUT ─────────────────────────────────────────────────── */
.page-content {
    min-height: 100vh;
    background: var(--bg);
    /* Mobile: 56px top bar + 16px gap; 80px bottom tab bar */
    padding: 72px 0 80px 0;
}

@media (min-width: 1024px) {
    .page-content {
        margin-left: 256px;
        padding: 24px 24px 24px 24px;
    }
}

/* ── CARDS ──────────────────────────────────────────────────── */
.erp-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f3f4f6;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    padding: 16px;
}

@media (min-width: 768px) {
    .erp-card { padding: 24px; }
}

/* ── STATUS BADGES ──────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
    line-height: 1.4;
    letter-spacing: 0.02em;
}

.badge-rascunho { background: #fef3c7; color: #d97706; }
.badge-confirmada { background: #d1fae5; color: #059669; }
.badge-cancelada { background: #fee2e2; color: #dc2626; }
.badge-credito { background: #d1fae5; color: #059669; }
.badge-debito { background: #fee2e2; color: #dc2626; }
.badge-info { background: #e0f2fe; color: #0284c7; }
.badge-violet { background: #ede9fe; color: #7c3aed; }

/* ── BUTTONS ────────────────────────────────────────────────── */
.btn-primary {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-decoration: none;
}
.btn-primary:hover { background: var(--primary-dark); }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-ghost {
    background: transparent;
    color: #374151;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-ghost:hover { background: #f9fafb; }

.btn-danger {
    background: #ef4444;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-danger:hover { background: #dc2626; }

/* ── FAB ────────────────────────────────────────────────────── */
.fab {
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 30;
    width: 56px;
    height: 56px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(124,58,237,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.fab:hover { background: var(--primary-dark); transform: scale(1.05); }

@media (min-width: 1024px) { .fab { display: none; } }

/* ── AVATAR ─────────────────────────────────────────────────── */
.avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    flex-shrink: 0;
}
.avatar-sm { width: 32px; height: 32px; font-size: 11px; }
.avatar-md { width: 40px; height: 40px; font-size: 13px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }

/* ── SKELETON ───────────────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}
@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

/* ── FORM INPUTS ────────────────────────────────────────────── */
.erp-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    outline: none;
    color: var(--text);
    background: #fff;
}
.erp-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

/* ── OVERLAY ────────────────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 50;
    backdrop-filter: blur(2px);
}

/* ── BOTTOM SHEET ───────────────────────────────────────────── */
.bottom-sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 20px 20px 0 0;
    padding: 24px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 51;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.12);
}

.bottom-sheet-handle {
    width: 40px;
    height: 4px;
    background: #e5e7eb;
    border-radius: 2px;
    margin: 0 auto 20px;
}

/* ── MODAL ──────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.modal {
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

/* ── PAGINATION ─────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0;
    font-size: 13px;
    color: var(--muted);
}
.pagination button {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    cursor: pointer;
    color: var(--primary);
    font-weight: 500;
    transition: all 0.2s;
}
.pagination button:hover:not(:disabled) { background: var(--primary-light); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; color: var(--muted); }

/* ── TABS ───────────────────────────────────────────────────── */
.tab-group {
    display: flex;
    gap: 4px;
    background: #f3f4f6;
    border-radius: 12px;
    padding: 4px;
    overflow-x: auto;
    scrollbar-width: none;
}
.tab-group::-webkit-scrollbar { display: none; }

.tab-item {
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    background: transparent;
    border: none;
    color: var(--muted);
}
.tab-item.active {
    background: #fff;
    color: var(--primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* ── FILTER CHIPS ───────────────────────────────────────────── */
.chip-group {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
}
.chip-group::-webkit-scrollbar { display: none; }

.chip {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    background: #f3f4f6;
    color: var(--muted);
    border: none;
    transition: all 0.2s;
}
.chip.active { background: var(--primary); color: #fff; }

/* ── TABLE ──────────────────────────────────────────────────── */
.erp-table { width: 100%; border-collapse: collapse; }
.erp-table thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    background: #f9fafb;
    border-bottom: 1px solid var(--border);
}
.erp-table tbody td {
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text);
    border-bottom: 1px solid #f3f4f6;
}
.erp-table tbody tr:last-child td { border-bottom: none; }
.erp-table tbody tr:hover td { background: #fafafa; }
.erp-table .total-row td { font-weight: 700; background: #faf5ff; }

/* ── WIZARD STEPS ───────────────────────────────────────────── */
.wizard-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
}
.wizard-step {
    display: flex;
    align-items: center;
    gap: 8px;
}
.wizard-step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.wizard-step-circle.done { background: var(--primary); color: #fff; }
.wizard-step-circle.active { background: var(--primary); color: #fff; box-shadow: 0 0 0 3px rgba(124,58,237,0.2); }
.wizard-step-circle.pending { background: #f3f4f6; color: var(--muted); }
.wizard-step-label { font-size: 12px; font-weight: 500; color: var(--muted); }
.wizard-step-label.active { color: var(--primary); font-weight: 600; }
.wizard-connector { flex: 1; height: 2px; background: #e5e7eb; min-width: 20px; max-width: 40px; }
.wizard-connector.done { background: var(--primary); }

/* ── CART BAR ───────────────────────────────────────────────── */
.cart-bar {
    position: fixed;
    bottom: 64px;
    left: 0;
    right: 0;
    background: #fff;
    border-top: 1px solid var(--border);
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 40;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.08);
}

@media (min-width: 1024px) {
    .cart-bar {
        left: 256px;
        bottom: 0;
    }
}

/* ── PRODUCT CARD ───────────────────────────────────────────── */
.product-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f3f4f6;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
}
.product-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.product-card.selected { border: 2px solid var(--primary); box-shadow: 0 0 0 3px rgba(124,58,237,0.1); }
.product-card-img {
    aspect-ratio: 1;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
}

/* ── QUANTITY CONTROL ───────────────────────────────────────── */
.qty-ctrl {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
}
.qty-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.qty-btn:hover { background: var(--primary-light); border-color: var(--primary); color: var(--primary); }
.qty-input {
    width: 48px;
    text-align: center;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
}

/* ── UPLOAD AREA ────────────────────────────────────────────── */
.upload-area {
    border: 2px dashed #c4b5fd;
    border-radius: 16px;
    height: 160px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    background: #faf5ff;
}
.upload-area:hover { background: #ede9fe; border-color: var(--primary); }

/* ── INFO BOX ───────────────────────────────────────────────── */
.info-box {
    background: #faf5ff;
    border: 1px solid #c4b5fd;
    border-radius: 10px;
    padding: 12px;
    font-size: 13px;
    color: #5b21b6;
}

.warning-box {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    border-radius: 10px;
    padding: 12px;
    font-size: 13px;
    color: #92400e;
}

/* ── SLIDE OVER ─────────────────────────────────────────────── */
.slide-over {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    background: #fff;
    z-index: 60;
    overflow-y: auto;
    box-shadow: -4px 0 24px rgba(0,0,0,0.12);
    transition: transform 0.3s ease;
}

@media (min-width: 768px) {
    .slide-over { width: 480px; }
}

/* ── STATS CARD ─────────────────────────────────────────────── */
.stat-card {
    background: #fff;
    border-radius: 16px;
    border: 1px solid #f3f4f6;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.stat-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}
.stat-value { font-size: 24px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 500; }

/* ── EMPTY STATE ────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--muted);
}
.empty-state .empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── UTILITY CLASSES ────────────────────────────────────────── */
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--muted) !important; }
.text-success { color: #059669 !important; }
.text-danger { color: #dc2626 !important; }
.text-warning { color: #d97706 !important; }
.fw-bold { font-weight: 700 !important; }
.fw-semibold { font-weight: 600 !important; }
.fw-medium { font-weight: 500 !important; }
.font-mono { font-family: 'Courier New', monospace; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-lg { font-size: 17px; }
.text-xl { font-size: 20px; }
.text-2xl { font-size: 24px; }
.gap-1 { gap: 4px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.d-flex { display: flex; }
.flex-col { flex-direction: column; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.w-full { width: 100%; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mt-8 { margin-top: 32px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.p-4 { padding: 16px; }
.p-6 { padding: 24px; }
.px-4 { padding-left: 16px; padding-right: 16px; }

/* ── RESPONSIVE DISPLAY UTILITIES ──────────────────────────── */
.d-none { display: none !important; }
.d-flex { display: flex !important; }
.d-block { display: block !important; }

@media (min-width: 768px) {
    .d-md-none { display: none !important; }
    .d-md-flex { display: flex !important; }
    .d-md-block { display: block !important; }
}

@media (min-width: 1024px) {
    .d-lg-none { display: none !important; }
    .d-lg-flex { display: flex !important; }
    .d-lg-block { display: block !important; }
}

/* ── MUDBLAZOR OVERRIDES ────────────────────────────────────── */
.mud-drawer { background: #111827 !important; }
.mud-drawer .mud-nav-link { color: #9ca3af !important; border-radius: 10px !important; margin: 2px 8px !important; }
.mud-drawer .mud-nav-link:hover { background: #1f2937 !important; color: #fff !important; }
.mud-drawer .mud-nav-link.active { background: #7c3aed !important; color: #fff !important; }
.mud-drawer .mud-nav-link.active .mud-icon-root { color: #fff !important; }
.mud-appbar { box-shadow: 0 1px 0 #e5e7eb !important; }
