/* Custom CSS Design System - Inventori Spare Part */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* Color Palette - Premium Slate & Dark theme */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.15);
    
    --border-color: rgba(148, 163, 184, 0.1);
    --border-hover: rgba(148, 163, 184, 0.2);
    
    /* PRD Condition Colors */
    --color-good: #10b981;       /* Hijau */
    --color-defect: #ef4444;     /* Merah */
    --color-quarantine: #f59e0b; /* Kuning */
    --color-refurbish: #3b82f6;  /* Biru */
    --color-expired: #6b7280;     /* Abu-abu */
    --color-hold: #f97316;        /* Oranye */
    
    /* Dimensions */
    --sidebar-width: 260px;
    --header-height: 70px;
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Layout */
.app-container {
    display: flex;
    width: 100vw;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition-normal);
}

.sidebar-header {
    height: var(--header-height);
    display: flex;
    align-items: center;
    padding: 0 24px;
    border-bottom: 1px solid var(--border-color);
}

.brand {
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-accent {
    color: var(--accent);
}

.sidebar-menu {
    list-style: none;
    padding: 24px 16px;
    flex: 1;
    overflow-y: auto;
}

.menu-label {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
    margin-top: 16px;
    padding-left: 8px;
}

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

.menu-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    color: var(--text-secondary);
    text-decoration: none;
    border-radius: var(--radius-md);
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.menu-link:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.05);
}

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

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.15);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.1);
}

.user-info {
    flex: 1;
    overflow: hidden;
}

.user-name {
    font-size: 0.875rem;
    font-weight: 600;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Main Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.main-header {
    height: var(--header-height);
    background-color: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 32px;
    position: sticky;
    top: 0;
    z-index: 90;
}

.header-title {
    font-size: 1.25rem;
    font-weight: 700;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Notifications Dropdown */
.notif-bell-container {
    position: relative;
    cursor: pointer;
}

.notif-bell {
    font-size: 1.25rem;
    color: var(--text-secondary);
    padding: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.03);
    transition: var(--transition-fast);
}

.notif-bell:hover {
    color: var(--text-primary);
    background-color: rgba(255, 255, 255, 0.08);
}

.notif-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    background-color: var(--color-defect);
    color: white;
    font-size: 0.65rem;
    font-weight: 800;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Dropdown list */
.notif-dropdown {
    position: absolute;
    top: 120%;
    right: 0;
    width: 320px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    display: none;
    overflow: hidden;
    z-index: 1000;
}

.notif-dropdown.show {
    display: block;
}

.notif-dropdown-header {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-weight: 600;
    font-size: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notif-list {
    max-height: 250px;
    overflow-y: auto;
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-decoration: none;
    color: var(--text-primary);
    transition: var(--transition-fast);
}

.notif-item:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.notif-item.unread {
    border-left: 3px solid var(--accent);
    background-color: rgba(99, 102, 241, 0.05);
}

.notif-item-title {
    font-weight: 600;
}

.notif-item-time {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.notif-empty {
    padding: 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.notif-dropdown-footer {
    padding: 10px;
    text-align: center;
    border-top: 1px solid var(--border-color);
    background-color: rgba(0, 0, 0, 0.1);
}

.notif-view-all {
    font-size: 0.75rem;
    color: var(--accent);
    text-decoration: none;
    font-weight: 600;
}

/* Page Content */
.page-container {
    padding: 32px;
    flex: 1;
}

/* Cards & Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.stat-card {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
    transition: var(--transition-normal);
}

.stat-card:hover {
    transform: translateY(-4px);
    border-color: var(--border-hover);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.4);
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--accent);
}

.stat-card.good::after { background-color: var(--color-good); }
.stat-card.defect::after { background-color: var(--color-defect); }
.stat-card.quarantine::after { background-color: var(--color-quarantine); }
.stat-card.refurbish::after { background-color: var(--color-refurbish); }
.stat-card.expired::after { background-color: var(--color-expired); }
.stat-card.hold::after { background-color: var(--color-hold); }

.stat-title {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 2.25rem;
    font-weight: 800;
    line-height: 1;
}

.stat-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Content Layout (Panel/Card) */
.card-panel {
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: 700;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    border: none;
    transition: var(--transition-fast);
    text-decoration: none;
}

.btn-primary {
    background-color: var(--accent);
    color: #fff;
}
.btn-primary:hover {
    background-color: var(--accent-hover);
    box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-primary);
}
.btn-secondary:hover {
    background-color: rgba(255,255,255,0.1);
}

.btn-success {
    background-color: var(--color-good);
    color: #fff;
}
.btn-success:hover {
    background-color: #059669;
}

.btn-danger {
    background-color: var(--color-defect);
    color: #fff;
}
.btn-danger:hover {
    background-color: #dc2626;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.8rem;
    border-radius: var(--radius-sm);
}

/* Data Tables */
.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.data-table th {
    background-color: rgba(0,0,0,0.15);
    padding: 16px;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    border-bottom: 1px solid var(--border-color);
}

.data-table td {
    padding: 16px;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
}

.data-table tr:hover td {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Condition Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
}

.badge.good { background-color: rgba(16, 185, 129, 0.15); color: var(--color-good); }
.badge.defect { background-color: rgba(239, 68, 68, 0.15); color: var(--color-defect); }
.badge.quarantine { background-color: rgba(245, 158, 107, 0.15); color: var(--color-quarantine); }
.badge.refurbish { background-color: rgba(59, 130, 246, 0.15); color: var(--color-refurbish); }
.badge.expired { background-color: rgba(107, 114, 128, 0.15); color: var(--color-expired); }
.badge.hold { background-color: rgba(249, 115, 22, 0.15); color: var(--color-hold); }

.badge.active { background-color: rgba(16, 185, 129, 0.15); color: var(--color-good); }
.badge.inactive { background-color: rgba(239, 68, 68, 0.15); color: var(--color-defect); }

/* Forms & Inputs */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-control::placeholder {
    color: var(--text-muted);
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Quick Search & Filters bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    background-color: rgba(0,0,0,0.1);
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
}

.filter-input {
    flex: 1;
    min-width: 200px;
}

/* Alert system */
.alert {
    padding: 16px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.95rem;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border: 1px solid var(--color-good);
    color: #a7f3d0;
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border: 1px solid var(--color-defect);
    color: #fca5a5;
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border: 1px solid var(--color-quarantine);
    color: #fde047;
}

/* Login Page Styles */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100vw;
    background-color: var(--bg-primary);
}

.login-card {
    width: 100%;
    max-width: 450px;
    background-color: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 40px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.6);
}

.login-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
    font-size: 1.8rem;
    font-weight: 800;
}

.login-demo-roles {
    margin-top: 30px;
    border-top: 1px solid var(--border-color);
    padding-top: 20px;
}

.login-demo-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 12px;
}

.demo-btn-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.btn-demo {
    padding: 6px;
    font-size: 0.75rem;
    background-color: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition-fast);
}

.btn-demo:hover {
    color: var(--text-primary);
    background-color: var(--border-hover);
}

/* Dynamic grid layout for details and cards */
.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
}

.details-block {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.details-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.details-value {
    font-size: 1rem;
    font-weight: 500;
}

/* Image styling */
.img-preview {
    max-width: 100px;
    max-height: 100px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    border: 1px solid var(--border-color);
}

.img-preview-lg {
    max-width: 100%;
    max-height: 300px;
    border-radius: var(--radius-md);
    object-fit: contain;
    border: 1px solid var(--border-color);
}

/* Dashboard chart container */
.chart-container {
    height: 300px;
    position: relative;
    margin-top: 15px;
}

/* Responsive fixes */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .page-container {
        padding: 16px;
    }
    .main-header {
        padding: 0 16px;
    }
}
