/**
 * Custom Styles - Inventaris Syawal
 * Clean & Minimal Design
 * UKK Level 3 Web Development
 */

/* ========================================
   ROOT VARIABLES - Soft Colors
======================================== */
:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: #eff6ff;

  --bg-body: #f8fafc;
  --bg-sidebar: #ffffff;
  --bg-card: #ffffff;
  --bg-hover: #f1f5f9;

  --text-primary: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --border-color: #e2e8f0;

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #0ea5e9;

  --font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;

  --sidebar-width: 260px;
  --transition: all 0.2s ease;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  --radius: 8px;
}

/* ========================================
   BASE STYLES
======================================== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
}

/* ========================================
   APP CONTAINER
======================================== */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* ========================================
   SIDEBAR
======================================== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 18px;
  color: var(--text-primary);
}

.sidebar-logo svg {
  color: var(--primary);
}

/* Sidebar Navigation */
.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  overflow-y: auto;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 0 12px;
  margin-bottom: 8px;
  display: block;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  margin-bottom: 2px;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--primary-light);
  color: var(--primary);
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-hover);
  display: flex;
  align-items: center;
  justify-content: center;
}

.user-avatar svg {
  width: 20px;
  height: 20px;
  color: var(--text-secondary);
}

.user-details {
  display: flex;
  flex-direction: column;
}

.user-name {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-primary);
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.logout-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: var(--transition);
}

.logout-btn:hover {
  background: #fee2e2;
  color: var(--danger);
}

.logout-btn svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   MAIN CONTENT
======================================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px 32px;
  min-height: 100vh;
}

/* ========================================
   PAGE HEADER
======================================== */
.page-header {
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.page-header p {
  color: var(--text-secondary);
  margin: 0;
}

/* ========================================
   CARDS
======================================== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  padding: 16px 20px;
  font-weight: 600;
}

.card-body {
  padding: 20px;
}

/* Stat Cards */
.stat-card {
  padding: 20px;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
}

.stat-card .stat-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-card .stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-card .stat-icon.primary {
  background: var(--primary-light);
  color: var(--primary);
}

.stat-card .stat-icon.success {
  background: #dcfce7;
  color: var(--success);
}

.stat-card .stat-icon.warning {
  background: #fef3c7;
  color: var(--warning);
}

.stat-card .stat-icon.danger {
  background: #fee2e2;
  color: var(--danger);
}

.stat-card .stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-secondary);
}

/* ========================================
   BUTTONS
======================================== */
.btn {
  font-weight: 500;
  padding: 8px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn svg {
  width: 16px;
  height: 16px;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-outline-primary {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-outline-primary:hover {
  background: var(--primary);
  color: white;
}

.btn-success {
  background: var(--success);
  border-color: var(--success);
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-sm svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   FORMS
======================================== */
.form-control,
.form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-label {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 6px;
  font-size: 14px;
}

/* ========================================
   TABLES
======================================== */
.table {
  margin-bottom: 0;
}

.table th {
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
  background: var(--bg-body);
}

.table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  color: var(--text-primary);
}

.table-hover tbody tr:hover {
  background: var(--bg-hover);
}

/* DataTables */
.dataTables_wrapper .dataTables_length,
.dataTables_wrapper .dataTables_filter,
.dataTables_wrapper .dataTables_info,
.dataTables_wrapper .dataTables_paginate {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 12px 0;
}

.dataTables_wrapper .dataTables_length label,
.dataTables_wrapper .dataTables_filter label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px 14px;
  margin-left: 8px;
  outline: none;
}

.dataTables_wrapper .dataTables_filter input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: 8px 32px 8px 14px;
  margin: 0 8px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: white
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E")
    no-repeat right 10px center;
  cursor: pointer;
  outline: none;
}

.dataTables_wrapper .dataTables_length select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

/* Pagination - Soft Style */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  border: 1px solid var(--border-color) !important;
  border-radius: 6px !important;
  background: white !important;
  color: var(--text-secondary) !important;
  margin: 0 2px;
  padding: 6px 12px !important;
  font-size: 13px;
  transition: all 0.15s ease;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: var(--primary) !important;
  border-color: var(--primary) !important;
  color: white !important;
}

.dataTables_wrapper
  .dataTables_paginate
  .paginate_button:hover:not(.current):not(.disabled) {
  background: var(--primary-light) !important;
  border-color: var(--primary) !important;
  color: var(--primary) !important;
}

.dataTables_wrapper .dataTables_paginate .paginate_button.disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ========================================
   BADGES
======================================== */
.badge {
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
}

.badge.bg-success {
  background: #dcfce7 !important;
  color: #15803d !important;
}

.badge.bg-warning {
  background: #fef3c7 !important;
  color: #b45309 !important;
}

.badge.bg-danger {
  background: #fee2e2 !important;
  color: #dc2626 !important;
}

.badge.bg-primary {
  background: var(--primary-light) !important;
  color: var(--primary) !important;
}

/* ========================================
   ALERTS
======================================== */
.alert {
  border: none;
  border-radius: var(--radius);
  padding: 14px 18px;
  font-size: 14px;
}

.alert-danger {
  background: #fee2e2;
  color: #dc2626;
}

.alert-success {
  background: #dcfce7;
  color: #15803d;
}

.alert-warning {
  background: #fef3c7;
  color: #b45309;
}

/* ========================================
   LIST GROUP
======================================== */
.list-group-item {
  border-color: var(--border-color);
  padding: 14px 16px;
}

/* ========================================
   LOGIN PAGE (Standalone)
======================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-body);
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-header {
  text-align: center;
  margin-bottom: 32px;
}

.login-header .logo {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
}

.login-header .logo svg {
  width: 24px;
  height: 24px;
  color: var(--primary);
}

.login-header h1 {
  font-size: 24px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 14px;
}

.demo-box {
  background: #dcfce7;
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 24px;
}

.demo-box p {
  margin: 0;
  font-size: 13px;
  color: #15803d;
}

/* ========================================
   SCROLLBAR
======================================== */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   RESPONSIVE
======================================== */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }
}
