/* ================================================
   ToyCon – Custom Styles
   ================================================ */

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

:root {
  --primary:        #4f46e5;
  --primary-dark:   #3730a3;
  --primary-light:  #818cf8;
  --sidebar-bg:     #0f172a;
  --sidebar-text:   #94a3b8;
  --sidebar-hover:  rgba(255,255,255,.06);
  --sidebar-active-bg:   rgba(79,70,229,.18);
  --sidebar-active-text: #a5b4fc;
  --sidebar-width:  260px;
  --page-bg:        #f1f5f9;
  --card-bg:        #ffffff;
  --text-main:      #1e293b;
  --text-muted:     #64748b;
  --border:         #e2e8f0;
  --success:        #10b981;
  --warning:        #f59e0b;
  --danger:         #ef4444;
  --info:           #3b82f6;
  --topbar-h:       60px;
}

/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--page-bg);
  color: var(--text-main);
  margin: 0;
  min-height: 100vh;
}
a { text-decoration: none; }

/* ===== LAYOUT ===== */
.app-wrapper {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  overflow-y: auto;
}

.sidebar-brand {
  padding: 1.25rem 1.1rem;
  border-bottom: 1px solid rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: .75rem;
  position: sticky;
  top: 0;
  background: var(--sidebar-bg);
  z-index: 1;
}

.brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.brand-name  { font-size: .93rem; font-weight: 700; color: #fff; line-height: 1.1; }
.brand-sub   { font-size: .68rem; color: var(--sidebar-text); margin-top: 1px; }

.sidebar-nav { flex: 1; padding: .75rem 0 1.5rem; }

.nav-section-title {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: #475569;
  padding: 1rem 1.1rem .35rem;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .55rem 1rem;
  margin: .1rem .6rem;
  border-radius: 8px;
  color: var(--sidebar-text);
  font-size: .84rem;
  font-weight: 500;
  transition: background .15s, color .15s;
}

.nav-item a:hover {
  background: var(--sidebar-hover);
  color: #e2e8f0;
}

.nav-item a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active-text);
}

.nav-icon { width: 18px; text-align: center; font-size: .95rem; opacity: .85; }

/* ===== MAIN WRAPPER ===== */
.main-wrapper {
  margin-left: var(--sidebar-width);
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ===== TOPBAR ===== */
.topbar {
  height: var(--topbar-h);
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title { font-size: .97rem; font-weight: 600; color: var(--text-main); }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
  color: var(--text-muted);
}

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.btn-mobile-menu {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  color: var(--text-main);
  cursor: pointer;
  padding: .25rem;
  margin-right: .5rem;
}

/* ===== CONTENT ===== */
.content {
  padding: 1.5rem;
  flex: 1;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: .75rem;
}

.page-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0;
}

.page-subtitle {
  font-size: .8rem;
  color: var(--text-muted);
  margin: .15rem 0 0;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform .2s, box-shadow .2s;
  height: 100%;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(0,0,0,.08);
}

.stat-icon {
  width: 48px; height: 48px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.stat-icon.blue   { background: #eff6ff; color: #3b82f6; }
.stat-icon.green  { background: #f0fdf4; color: #16a34a; }
.stat-icon.orange { background: #fff7ed; color: #ea580c; }
.stat-icon.red    { background: #fef2f2; color: #dc2626; }
.stat-icon.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon.teal   { background: #f0fdfa; color: #0d9488; }

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
  word-break: break-word;
}

.stat-label {
  font-size: .75rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: .2rem;
}

.stat-sub {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .15rem;
}

@media (max-width: 767.98px) {
  .stat-card {
    padding: .85rem .75rem;
    gap: .65rem;
  }
  .stat-icon {
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
    border-radius: 10px;
  }
  .stat-value {
    font-size: 1.05rem;
  }
  .stat-label {
    font-size: .68rem;
  }
  .stat-sub {
    font-size: .65rem;
  }
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: 14px;
  border: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: transparent;
  font-weight: 600;
  font-size: .88rem;
  border-radius: 14px 14px 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-body { padding: 1.25rem; }

/* ===== TABLES ===== */
.table-responsive { border-radius: 14px; border: 1px solid var(--border); overflow: hidden; }

.table {
  font-size: .845rem;
  margin: 0;
}

.table thead th {
  background: #f8fafc;
  font-size: .74rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  padding: .8rem 1rem;
  white-space: nowrap;
}

.table tbody td {
  padding: .8rem 1rem;
  border-color: #f1f5f9;
  vertical-align: middle;
}

.table tbody tr:hover td { background: #f8fafc; }
.table tbody tr:last-child td { border-bottom: none; }

/* ===== BADGES STATUS ===== */
.badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .3rem .65rem;
  border-radius: 20px;
  letter-spacing: .015em;
}

.badge-aktif   { background: #d1fae5; color: #065f46; }
.badge-retur   { background: #fee2e2; color: #991b1b; }
.badge-selesai { background: #e0e7ff; color: #3730a3; }
.badge-hampir  { background: #fef3c7; color: #92400e; }
.badge-jatuh   { background: #fce7f3; color: #9d174d; }

/* ===== FORMS ===== */
.form-label {
  font-size: .84rem;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: .35rem;
}

.form-control, .form-select {
  font-size: .875rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: .52rem .85rem;
  color: var(--text-main);
  transition: border-color .15s, box-shadow .15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.12);
  outline: none;
}

.form-text { font-size: .75rem; color: var(--text-muted); }

/* ===== BUTTONS ===== */
.btn {
  font-size: .845rem;
  font-weight: 500;
  border-radius: 8px;
  padding: .48rem 1rem;
  transition: all .2s;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(79,70,229,.35);
}

.btn-outline-primary { color: var(--primary); border-color: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; }

.btn-sm { padding: .3rem .65rem; font-size: .78rem; }
.btn-icon { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }

/* ===== ALERTS ===== */
.alert {
  border-radius: 10px;
  font-size: .86rem;
  border: none;
  padding: .75rem 1rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
}
.empty-state .empty-icon { font-size: 2.5rem; opacity: .35; margin-bottom: .75rem; }
.empty-state p { font-size: .85rem; color: var(--text-muted); margin: 0; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: flex;
  gap: .6rem;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar .form-control,
.filter-bar .form-select { max-width: 200px; }

/* ===== COUNTDOWN ===== */
.countdown {
  font-size: .76rem;
  font-weight: 600;
  padding: .22rem .55rem;
  border-radius: 20px;
  display: inline-block;
}

/* ===== DIVIDER ===== */
.section-divider {
  height: 1px;
  background: var(--border);
  margin: 1.25rem 0;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar         { width: 5px; height: 5px; }
::-webkit-scrollbar-track   { background: transparent; }
::-webkit-scrollbar-thumb   { background: #cbd5e1; border-radius: 10px; }

/* ===== LOGIN PAGE ===== */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-card {
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.35);
}

.login-brand {
  text-align: center;
  margin-bottom: 2rem;
}

.login-brand .brand-icon-lg {
  width: 60px; height: 60px;
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  border-radius: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.75rem;
  margin-bottom: .75rem;
}

.login-brand h1 {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
}

.login-brand p {
  font-size: .82rem;
  color: #94a3b8;
  margin: .3rem 0 0;
}

.login-card .form-label { color: #cbd5e1; }

.login-card .form-control {
  background: rgba(255,255,255,.07);
  border-color: rgba(255,255,255,.12);
  color: #fff;
}

.login-card .form-control:focus {
  background: rgba(255,255,255,.1);
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(99,102,241,.25);
  color: #fff;
}

.login-card .form-control::placeholder { color: #475569; }

.btn-login {
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border: none;
  color: #fff;
  font-weight: 600;
  width: 100%;
  padding: .75rem;
  border-radius: 10px;
  font-size: .9rem;
  transition: all .2s;
  margin-top: .5rem;
}

.btn-login:hover {
  opacity: .9;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(79,70,229,.45);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .btn-mobile-menu { display: block; }
  .stat-value { font-size: 1.2rem; }
  .content { padding: 1rem; }
}

@media (max-width: 576px) {
  .page-header { flex-direction: column; align-items: flex-start; }
}
