/* ============================================================
   PT Arta Boga Indonesia — Sistem Inventory
   assets/css/app.css
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
  --primary:        #1A56A0;
  --primary-dark:   #133D78;
  --primary-light:  #EBF2FC;
  --accent:         #E87722;
  --accent-light:   #FEF3E9;

  --success:        #198754;
  --danger:         #DC3545;
  --warning:        #FFC107;
  --info:           #0DCAF0;

  --sidebar-width:     260px;
  --sidebar-collapsed: 70px;
  --topbar-height:     60px;

  --bg-page:        #F4F6F9;
  --bg-card:        #FFFFFF;
  --bg-sidebar:     #0F2A5C;
  --sidebar-text:   rgba(255,255,255,0.75);
  --sidebar-active: #FFFFFF;
  --sidebar-hover:  rgba(255,255,255,0.12);

  --text-dark:      #1A1F36;
  --text-muted:     #6B7280;

  --border:         #E5E7EB;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,.10);
  --radius:         8px;
  --radius-lg:      12px;

  --font-sans:      'Inter', system-ui, sans-serif;
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-dark);
  background: var(--bg-page);
  margin: 0;
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  overflow-y: auto;
  overflow-x: hidden;
  transition: width .3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

body.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed); }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,.08);
  transition: padding .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 18px; color: #fff;
}

.brand-text {
  transition: opacity .2s ease, visibility .2s ease;
}

.brand-name {
  display: block;
  font-weight: 700;
  font-size: .9rem;
  color: #fff;
  line-height: 1.2;
}
.brand-company {
  display: block;
  font-size: .7rem;
  color: var(--sidebar-text);
}

body.sidebar-collapsed .brand-text,
body.sidebar-collapsed .nav-section,
body.sidebar-collapsed .user-info,
body.sidebar-collapsed .sidebar .nav-link span {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  white-space: nowrap;
}

body.sidebar-collapsed .sidebar-brand {
  padding-left: 17px;
  padding-right: 17px;
}

/* ── Sidebar Nav ────────────────────────────────────────────── */
.sidebar-nav { padding: 10px 0; }

.nav-section {
  padding: 14px 20px 4px;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: rgba(255,255,255,.35);
  transition: opacity .2s ease, visibility .2s ease;
}

.sidebar-nav .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: var(--sidebar-text);
  border-radius: 0;
  font-weight: 500;
  white-space: nowrap;
  transition: background .2s, color .2s, padding .3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-nav .nav-link i {
  font-size: 1.05rem;
  flex-shrink: 0;
  width: 20px;
  text-align: center;
}

.sidebar-nav .nav-link span {
  transition: opacity .2s ease, visibility .2s ease;
}

.sidebar-nav .nav-link:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-active);
}

.sidebar-nav .nav-link.active {
  background: linear-gradient(90deg, rgba(232, 119, 34, 0.15) 0%, rgba(255, 255, 255, 0.05) 100%);
  color: var(--sidebar-active);
  border-left: 4px solid var(--accent);
  padding-left: 16px;
  font-weight: 600;
}

body.sidebar-collapsed .sidebar-nav .nav-link {
  padding-left: 25px;
}

/* ── Sidebar Footer ─────────────────────────────────────────── */
.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  margin-top: auto;
  transition: padding .3s cubic-bezier(0.4, 0, 0.2, 1), flex-direction .3s;
}

.sidebar-user { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; transition: justify-content .3s; }

.user-avatar {
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .85rem; color: #fff;
  flex-shrink: 0;
}

.user-info {
  transition: opacity .2s ease, visibility .2s ease;
}

.user-name {
  display: block;
  color: #fff;
  font-weight: 600;
  font-size: .8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  background: rgba(255,255,255,.15);
  color: rgba(255,255,255,.8);
  font-size: .65rem;
  padding: 1px 6px;
  border-radius: 4px;
}

.btn-logout {
  color: rgba(255,255,255,.5);
  font-size: 1.1rem;
  flex-shrink: 0;
  text-decoration: none;
  transition: color .15s;
}
.btn-logout:hover { color: var(--danger); }

body.sidebar-collapsed .sidebar-footer {
  flex-direction: column;
  gap: 12px;
  padding: 14px 0;
}

body.sidebar-collapsed .sidebar-user {
  justify-content: center;
}

/* ── Main Wrapper ───────────────────────────────────────────── */
#main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  transition: margin-left .25s ease;
}

body.sidebar-collapsed #main-wrapper { margin-left: var(--sidebar-collapsed); }

/* ── Topbar ─────────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0;
  height: var(--topbar-height);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  z-index: 900;
  box-shadow: var(--shadow-sm);
}

.btn-toggle {
  background: none; border: none;
  font-size: 1.3rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background .15s;
}
.btn-toggle:hover { background: var(--primary-light); color: var(--primary); }

.topbar-breadcrumb .breadcrumb-item a { color: var(--primary); text-decoration: none; }
.topbar-breadcrumb .breadcrumb-item.active { color: var(--text-muted); }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ── Page Header ────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.page-title { font-size: 1.35rem; font-weight: 700; margin: 0; color: var(--text-dark); }
.page-subtitle { font-size: .8rem; color: var(--text-muted); margin-top: 2px; }

/* ── Cards ──────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 20px;
  font-weight: 600;
  font-size: .9rem;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}

.card-body { padding: 20px; }

/* ── Stat Cards ─────────────────────────────────────────────── */
.stat-card {
  border-left: 4px solid var(--primary);
  transition: transform .15s, box-shadow .15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.accent   { border-left-color: var(--accent); }
.stat-card.success  { border-left-color: var(--success); }
.stat-card.danger   { border-left-color: var(--danger); }
.stat-card.warning  { border-left-color: var(--warning); }

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  background: var(--primary-light); color: var(--primary);
}
.stat-card.accent  .stat-icon { background: var(--accent-light);  color: var(--accent); }
.stat-card.success .stat-icon { background: #D1FAE5; color: var(--success); }
.stat-card.danger  .stat-icon { background: #FEE2E2; color: var(--danger); }
.stat-card.warning .stat-icon { background: #FEF9C3; color: #92400E; }

.stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-dark); }
.stat-label { font-size: .78rem; color: var(--text-muted); }

/* ── Tables ─────────────────────────────────────────────────── */
.table { font-size: .85rem; }
.table th { font-weight: 600; white-space: nowrap; background: #F8FAFC; }
.table td { vertical-align: middle; }
.table-hover tbody tr:hover { background-color: var(--primary-light); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge-status {
  padding: 4px 10px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: capitalize;
}

/* ── Forms ──────────────────────────────────────────────────── */
.form-label { font-weight: 500; font-size: .85rem; margin-bottom: 4px; }
.form-control, .form-select {
  border-radius: var(--radius);
  border-color: var(--border);
  font-size: .875rem;
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26,86,160,.12);
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  font-weight: 500;
  border-radius: var(--radius);
  font-size: .85rem;
}
.btn-primary   { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn-accent    { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { filter: brightness(.9); color: #fff; }

/* ── Login Page ─────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--bg-sidebar) 0%, var(--primary) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 16px;
  padding: 40px 36px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}

.login-logo {
  width: 54px; height: 54px;
  background: var(--accent);
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; color: #fff;
  margin: 0 auto 16px;
}

/* ── Alert ──────────────────────────────────────────────────── */
.alert { border-radius: var(--radius); font-size: .85rem; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width) !important; transition: transform .3s cubic-bezier(0.4, 0, 0.2, 1) !important; }
  body.sidebar-open .sidebar { transform: translateX(0); }
  #main-wrapper { margin-left: 0 !important; }
  .main-content { padding: 16px; }
  body.sidebar-open::before {
    content: '';
    position: fixed; inset: 0;
    background: rgba(15, 42, 92, 0.4);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 999;
    animation: fadeInOverlay .25s ease forwards;
  }
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}
