/* ===================================================
   StockSync — Custom Styles
   Backstage Dark Mode Theme
   =================================================== */

/* — Base resets & scrollbar — */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* — Sidebar — */
.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 260px;
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid rgba(255, 255, 255, 0.04);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
}

.nav-link:hover {
    color: #e2e8f0;
    background: rgba(255, 255, 255, 0.04);
}

.nav-link.active {
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.08);
    box-shadow: inset 3px 0 0 #22d3ee;
}

.nav-link.active i {
    filter: drop-shadow(0 0 6px rgba(34, 211, 238, 0.4));
}

/* — Main content — */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 32px 40px;
    min-height: 100vh;
}

/* — Mobile bar — */
.mobile-bar {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 50;
}

.mobile-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 35;
    backdrop-filter: blur(4px);
}

/* — Glassmorphism cards — */
.glass-card {
    background: rgba(30, 41, 59, 0.45);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.glass-subtle {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

/* — Views — */
.view {
    display: none;
    animation: fadeIn 0.35s ease;
}

.view.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-12px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-down {
    animation: slideDown 0.3s ease;
}

/* — Progress bars — */
.progress-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.06);
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    border-radius: 4px;
    background: linear-gradient(90deg, #06b6d4, #22d3ee);
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.15) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        transform: translateX(-100%);
    }

    100% {
        transform: translateX(100%);
    }
}

.progress-fill.critical {
    background: linear-gradient(90deg, #ef4444, #f59e0b);
}

.progress-fill.low {
    background: linear-gradient(90deg, #f59e0b, #eab308);
}

/* — Buttons — */
.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: linear-gradient(135deg, #0891b2, #22d3ee);
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 10px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(34, 211, 238, 0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(34, 211, 238, 0.35);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.04);
    color: #94a3b8;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-icon:hover {
    background: rgba(34, 211, 238, 0.1);
    color: #22d3ee;
    border-color: rgba(34, 211, 238, 0.2);
}

.btn-icon.danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border-color: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.03);
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-sm:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e2e8f0;
}

.btn-sm.primary {
    background: linear-gradient(135deg, #0891b2, #22d3ee);
    color: white;
    border: none;
    box-shadow: 0 1px 8px rgba(34, 211, 238, 0.2);
}

.btn-sm.primary:hover {
    box-shadow: 0 2px 12px rgba(34, 211, 238, 0.3);
}

/* — Form inputs — */
.form-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.8125rem;
    color: #e2e8f0;
    transition: all 0.2s ease;
}

.form-input::placeholder {
    color: #475569;
}

.form-input:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

/* — Inventory table — */
#inventory-tbody tr {
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    transition: background 0.15s ease;
}

#inventory-tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

#inventory-tbody td {
    padding: 14px 20px;
    white-space: nowrap;
}

/* Stock level badges */
.stock-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 52px;
    padding: 4px 12px;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
}

.stock-badge.ok {
    background: rgba(34, 197, 94, 0.1);
    color: #4ade80;
}

.stock-badge.low {
    background: rgba(245, 158, 11, 0.1);
    color: #fbbf24;
}

.stock-badge.critical {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.7;
    }
}

/* — Drop zone — */
.drop-zone {
    border: 2px dashed rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 48px 24px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.drop-zone:hover,
.drop-zone.drag-over {
    border-color: rgba(34, 211, 238, 0.3);
    background: rgba(34, 211, 238, 0.03);
}

.drop-zone.drag-over {
    transform: scale(1.01);
}

/* — Toast notifications — */
.toast {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 20px;
    border-radius: 12px;
    background: rgba(30, 41, 59, 0.92);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    color: #e2e8f0;
    font-size: 0.8125rem;
    animation: toastIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 400px;
}

.toast.success {
    border-left: 3px solid #22c55e;
}

.toast.error {
    border-left: 3px solid #ef4444;
}

.toast.info {
    border-left: 3px solid #22d3ee;
}

.toast.leaving {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }

    to {
        opacity: 0;
        transform: translateX(40px);
    }
}

/* — Modal — */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 60;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.modal-overlay.hidden {
    display: none;
}

.modal-content {
    animation: slideDown 0.3s ease;
    max-height: 85vh;
    overflow-y: auto;
}

/* — Product card — */
.product-card {
    background: rgba(30, 41, 59, 0.45);
    backdrop-filter: blur(16px) saturate(150%);
    -webkit-backdrop-filter: blur(16px) saturate(150%);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 24px;
    transition: all 0.3s ease;
}

.product-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

/* BOM row */
.bom-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.bom-row select,
.bom-row input {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 0.8125rem;
    color: #e2e8f0;
    transition: all 0.2s ease;
}

.bom-row select:focus,
.bom-row input:focus {
    outline: none;
    border-color: rgba(34, 211, 238, 0.4);
    box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.08);
}

.bom-row select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* Build check row */
.build-check-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    background: rgba(255, 255, 255, 0.02);
}

.build-check-row.sufficient {
    border-color: rgba(34, 197, 94, 0.15);
    background: rgba(34, 197, 94, 0.04);
}

.build-check-row.insufficient {
    border-color: rgba(239, 68, 68, 0.15);
    background: rgba(239, 68, 68, 0.04);
}

/* — Responsive — */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .mobile-bar {
        display: flex;
    }

    .main-content {
        margin-left: 0;
        padding: 72px 16px 24px;
    }
}

/* — Utility: Critical item row — */
.critical-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(239, 68, 68, 0.04);
    border: 1px solid rgba(239, 68, 68, 0.08);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.critical-item:hover {
    background: rgba(239, 68, 68, 0.08);
}

/* — Select dropdown styling — */
select option {
    background: #1e293b;
    color: #e2e8f0;
}

/* — Quick-add counter animation — */
.stock-counter {
    transition: transform 0.15s ease;
}

.stock-counter.bump {
    transform: scale(1.15);
}