/* ======================================================
   SMART WEIGH — Premium Ultra Design System
   ====================================================== */

/* === Google Font === */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;700;800&display=swap');

:root {
    --sw-primary: #6366f1;
    --sw-primary-light: #818cf8;
    --sw-primary-dark: #4f46e5;
    --sw-accent: #10b981;
    --sw-accent-dark: #059669;
    --sw-danger: #ef4444;
    --sw-warning: #f59e0b;
    --sw-surface: #ffffff;
    --sw-surface-alt: #f8fafc;
    --sw-border: #e2e8f0;
    --sw-text: #0f172a;
    --sw-text-muted: #64748b;
    --sw-radius: 16px;
    --sw-radius-sm: 10px;
    --sw-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.02);
    --sw-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -2px rgba(0,0,0,0.03);
    --sw-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.06), 0 4px 6px -4px rgba(0,0,0,0.03);
}

html.dark {
    --sw-surface: #0f172a;
    --sw-surface-alt: #1e293b;
    --sw-border: #1e293b;
    --sw-text: #f1f5f9;
    --sw-text-muted: #94a3b8;
    --sw-shadow: 0 1px 3px rgba(0,0,0,0.3);
    --sw-shadow-md: 0 4px 6px rgba(0,0,0,0.35);
    --sw-shadow-lg: 0 10px 15px rgba(0,0,0,0.4);
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Form Inputs === */
.form-input {
    width: 100%;
    padding: 0.625rem 1rem;
    border: 1.5px solid var(--sw-border);
    border-radius: var(--sw-radius-sm);
    background: var(--sw-surface);
    color: var(--sw-text);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
}

.form-input:focus {
    outline: none;
    border-color: var(--sw-primary);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.1);
}

.form-input::placeholder {
    color: var(--sw-text-muted);
    font-weight: 400;
}

html.dark .form-input {
    background: #1e293b;
    border-color: #334155;
    color: #f1f5f9;
}

html.dark .form-input:focus {
    border-color: var(--sw-primary-light);
    box-shadow: 0 0 0 4px rgba(99,102,241,0.2);
}

/* === Checkbox === */
.form-checkbox {
    width: 1.25rem;
    height: 1.25rem;
    accent-color: var(--sw-primary);
    border-radius: 6px;
    cursor: pointer;
}

/* === Premium Card === */
.premium-card {
    background: var(--sw-surface);
    border-radius: var(--sw-radius);
    border: 1px solid var(--sw-border);
    box-shadow: var(--sw-shadow);
    transition: all 0.3s cubic-bezier(0.4,0,0.2,1);
}

.premium-card:hover {
    box-shadow: var(--sw-shadow-md);
    border-color: rgba(99,102,241,0.15);
}

html.dark .premium-card {
    background: #1e293b;
    border-color: #334155;
}

html.dark .premium-card:hover {
    border-color: rgba(99,102,241,0.3);
}

/* === Buttons === */
.btn-primary {
    background: linear-gradient(135deg, var(--sw-primary), var(--sw-primary-dark));
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: var(--sw-radius-sm);
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s cubic-bezier(0.4,0,0.2,1);
    box-shadow: 0 2px 8px rgba(99,102,241,0.25);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99,102,241,0.35);
    filter: brightness(1.05);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-secondary {
    background: var(--sw-surface);
    color: var(--sw-text);
    padding: 0.625rem 1.5rem;
    border-radius: var(--sw-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    border: 1.5px solid var(--sw-border);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: var(--sw-surface-alt);
    border-color: var(--sw-primary-light);
    color: var(--sw-primary);
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    padding: 0.625rem 1.5rem;
    border-radius: var(--sw-radius-sm);
    font-weight: 700;
    font-size: 0.875rem;
    border: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(239,68,68,0.25);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239,68,68,0.35);
}

/* === Status Badges === */
.badge {
    padding: 0.2rem 0.75rem;
    font-size: 0.65rem;
    font-weight: 800;
    border-radius: 9999px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-danger  { background: #fee2e2; color: #991b1b; }
.badge-warning { background: #fef9c3; color: #854d0e; }
.badge-info    { background: #e0e7ff; color: #3730a3; }
.badge-neutral { background: #f1f5f9; color: #475569; }

html.dark .badge-success { background: #052e16; color: #86efac; }
html.dark .badge-danger  { background: #450a0a; color: #fca5a5; }
html.dark .badge-warning { background: #422006; color: #fde047; }
html.dark .badge-info    { background: #1e1b4b; color: #a5b4fc; }
html.dark .badge-neutral { background: #1e293b; color: #94a3b8; }

/* Badge with pulsing dot */
.badge-dot::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    display: inline-block;
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* === Premium Table === */
.premium-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.premium-table thead th {
    padding: 0.875rem 1.25rem;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--sw-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 2px solid var(--sw-border);
    background: var(--sw-surface-alt);
    white-space: nowrap;
}

.premium-table thead th:first-child {
    border-top-left-radius: var(--sw-radius);
}

.premium-table thead th:last-child {
    border-top-right-radius: var(--sw-radius);
}

.premium-table tbody tr {
    transition: all 0.15s ease;
    border-bottom: 1px solid var(--sw-border);
}

.premium-table tbody tr:last-child {
    border-bottom: none;
}

.premium-table tbody tr:hover {
    background: rgba(99,102,241,0.04);
}

html.dark .premium-table tbody tr:hover {
    background: rgba(99,102,241,0.08);
}

.premium-table tbody td {
    padding: 0.875rem 1.25rem;
    font-size: 0.875rem;
    color: var(--sw-text);
    vertical-align: middle;
}

/* === Animations === */
.fade-in {
    animation: fadeIn 0.4s cubic-bezier(0.4,0,0.2,1);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* HTMX transitions */
.htmx-swapping {
    opacity: 0;
    transition: opacity 0.2s ease-out;
}

.htmx-added {
    animation: fadeIn 0.3s ease-out;
}

/* === Glassmorphism === */
.glass {
    background: rgba(255,255,255,0.6);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255,255,255,0.25);
}

html.dark .glass {
    background: rgba(15,23,42,0.7);
    border-color: rgba(51,65,85,0.4);
}

/* === Skeleton Loader === */
.skeleton {
    background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.8s ease-in-out infinite;
    border-radius: 8px;
}

html.dark .skeleton {
    background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
    background-size: 200% 100%;
}

@keyframes skeleton-shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* === Industrial Weight Display === */
.weight-display {
    font-family: 'JetBrains Mono', monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
}

/* === Scrollbar === */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.custom-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.custom-scrollbar::-webkit-scrollbar-track { background: transparent; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
html.dark .custom-scrollbar::-webkit-scrollbar-thumb { background: #334155; }
.custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e2e8f0; border-radius: 10px; }
html.dark ::-webkit-scrollbar-thumb { background: #334155; }

/* === Industrial Panel Effect === */
.industrial-bg {
    background-image: 
        radial-gradient(circle at 1px 1px, rgba(99,102,241,0.03) 1px, transparent 0);
    background-size: 20px 20px;
}

/* === Sidebar Active Indicator === */
.nav-link-active {
    position: relative;
}
.nav-link-active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--sw-primary);
    border-radius: 0 4px 4px 0;
}