/* style.css - StockDoot ERP Premium Glassmorphism Design System */

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

:root {
    /* Light Mode Palette */
    --bg-base: #f4f6fa;
    --bg-surface: rgba(255, 255, 255, 0.75);
    --bg-sidebar: #0f172a;
    --border-color: rgba(0, 0, 0, 0.08);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-light: rgba(99, 102, 241, 0.1);
    --accent: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --sidebar-text: #94a3b8;
    --sidebar-active-bg: rgba(255, 255, 255, 0.1);
    --sidebar-active-text: #ffffff;
    --card-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.04);
}

[data-theme="dark"] {
    /* Dark Mode Palette */
    --bg-base: #0b0f19;
    --bg-surface: rgba(17, 24, 39, 0.8);
    --border-color: rgba(255, 255, 255, 0.06);
    --text-main: #f1f5f9;
    --text-muted: #94a3b8;
    --primary: #818cf8;
    --primary-hover: #6366f1;
    --primary-light: rgba(129, 140, 248, 0.15);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

/* General Reset & Reset Defaults */
body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-base);
    color: var(--text-main);
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

/* Glassmorphism System Card */
.glass-card {
    background: var(--bg-surface);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    padding: 24px;
    margin-bottom: 24px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.glass-card:hover {
    box-shadow: var(--card-shadow);
}

/* Layout - Sidebar & Main Container */
.sidebar {
    background-color: var(--bg-sidebar);
    color: var(--sidebar-text);
    width: 260px;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
}

.sidebar-header {
    padding: 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-brand {
    font-weight: 800;
    font-size: 22px;
    letter-spacing: -0.5px;
    color: #ffffff;
    background: linear-gradient(135deg, #a5b4fc 0%, #818cf8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 16px 8px;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-menu::-webkit-scrollbar {
    width: 4px;
}

.sidebar-menu::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.sidebar-item {
    margin-bottom: 4px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    color: var(--sidebar-text);
    text-decoration: none;
    border-radius: 10px;
    font-weight: 500;
    font-size: 15px;
    transition: all 0.2s ease;
}

.sidebar-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.05);
}

.sidebar-item.active .sidebar-link {
    color: var(--sidebar-active-text);
    background-color: var(--primary);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

.main-content {
    margin-left: 260px;
    padding: 32px;
    min-height: 100vh;
    transition: margin-left 0.3s ease;
}

/* Page Header */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
}

.page-title {
    font-weight: 700;
    font-size: 28px;
    letter-spacing: -0.5px;
    margin: 0;
}

/* Quick Stats Widgets */
.stat-widget {
    position: relative;
    overflow: hidden;
}

.stat-icon {
    position: absolute;
    right: 20px;
    bottom: 20px;
    font-size: 48px;
    opacity: 0.1;
    color: var(--primary);
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    margin: 8px 0 4px 0;
}

.stat-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Beautiful Status Badges */
.badge-isp {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 30px;
    display: inline-block;
}

.badge-available { background-color: rgba(16, 185, 129, 0.15); color: #10b981; }
.badge-assigned { background-color: rgba(168, 85, 247, 0.15); color: #a855f7; }
.badge-installed { background-color: rgba(99, 102, 241, 0.15); color: #6366f1; }
.badge-faulty { background-color: rgba(245, 158, 11, 0.15); color: #f59e0b; }
.badge-inrepair { background-color: rgba(14, 165, 233, 0.15); color: #0ea5e9; }
.badge-scrapped { background-color: rgba(100, 116, 139, 0.15); color: #64748b; }
.badge-lost { background-color: rgba(239, 68, 68, 0.15); color: #ef4444; }

/* Custom Inputs & Interactive Forms */
.form-control, .form-select {
    background-color: rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    border-radius: 10px;
    padding: 10px 14px;
    transition: all 0.2s ease;
}

[data-theme="dark"] .form-control, [data-theme="dark"] .form-select {
    background-color: rgba(255, 255, 255, 0.03);
}

.form-control:focus, .form-select:focus {
    background-color: transparent;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
    color: var(--text-main);
}

/* Timeline Components (Device History) */
.timeline-visual {
    position: relative;
    padding: 20px 0;
    margin-left: 20px;
}

.timeline-visual::before {
    content: '';
    position: absolute;
    top: 0;
    left: 9px;
    height: 100%;
    width: 2px;
    background: var(--border-color);
}

.timeline-node {
    position: relative;
    padding-left: 40px;
    margin-bottom: 25px;
}

.timeline-node::before {
    content: '';
    position: absolute;
    left: 0;
    top: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    border: 4px solid var(--bg-base);
    box-shadow: 0 0 0 3px var(--primary-light);
    z-index: 2;
}

.timeline-node.purchased::before { background: #10b981; }
.timeline-node.issued::before { background: #f59e0b; }
.timeline-node.installed::before { background: #6366f1; }
.timeline-node.returned::before { background: #a855f7; }
.timeline-node.repair::before { background: #0ea5e9; }
.timeline-node.scrap::before { background: #64748b; }
.timeline-node.lost::before { background: #ef4444; }

.timeline-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.timeline-desc {
    font-size: 14px;
    color: var(--text-muted);
}

/* Custom Table Styles */
.table {
    color: var(--text-main);
    border-color: var(--border-color);
}

.table th {
    background-color: rgba(0, 0, 0, 0.02);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 2px solid var(--border-color);
}

[data-theme="dark"] .table th {
    background-color: rgba(255, 255, 255, 0.02);
}

.table td {
    vertical-align: middle;
    border-bottom: 1px solid var(--border-color);
}

/* Buttons */
.btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
    border-radius: 10px;
    padding: 10px 20px;
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
    transition: all 0.2s ease;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Light / Dark Mode Toggle button */
.theme-toggle-btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    cursor: pointer;
    box-shadow: var(--card-shadow);
}

/* PWA Online/Offline Indicator Banner */
.online-banner {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    border-radius: 30px;
    padding: 10px 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.online-banner.online {
    background-color: #d1fae5;
    color: #065f46;
}

.online-banner.offline {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: currentColor;
    display: inline-block;
}

/* Quick Search Dropdown */
.search-results-list {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    position: absolute;
    width: 100%;
    z-index: 500;
    background: var(--bg-surface);
    box-shadow: var(--card-shadow);
}

/* Dark Mode Form Element Adjustments */
[data-theme="dark"] .modal-content {
    background-color: #0f172a;
    border: 1px solid var(--border-color);
    color: var(--text-main);
}

[data-theme="dark"] .modal-header {
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .modal-footer {
    border-top: 1px solid var(--border-color);
}

/* Print Overrides */
@media print {
    .sidebar, .navbar, .theme-toggle-btn, .online-banner, .btn, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
}
