/* ================================================
   LAUTAN DIGITAL ? Custom Theme
   Dependencies: Bootstrap 4, Font Awesome 5 (CDN)
   ================================================

   Daftar Section:
   1.  CSS Variables
   2.  Base
   3.  Layout (Wrapper)
   4.  Sidebar
   5.  Topbar
   6.  Content Area
   7.  Cards
   8.  Forms
   9.  Buttons
   10. Tables
   11. Badges & Alerts
   12. Scroll-to-Top & Footer
   13. Login Page
   14. Error Pages
   15. Responsive

   ================================================ */


/* ================================================
   1. CSS Variables
   ================================================ */
:root {
  /* Brand */
  --primary:        #2563EB;
  --primary-dark:   #1D4ED8;
  --primary-light:  #DBEAFE;
  --secondary:      #64748B;
  --success:        #059669;
  --warning:        #D97706;
  --danger:         #DC2626;
  --info:           #0284C7;

  /* Sidebar */
  --sidebar-bg:     #1E293B;
  --sidebar-dark:   #0F172A;
  --sidebar-text:   rgba(255, 255, 255, 0.72);
  --sidebar-hover:  rgba(255, 255, 255, 0.08);
  --sidebar-width:  250px;
  --sidebar-brand-h: 64px;

  /* Topbar */
  --topbar-h:       60px;

  /* Content */
  --content-bg:     #F1F5F9;
  --card-radius:    0.5rem;
  --card-shadow:    0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.05);
  --border-color:   #E2E8F0;

  /* Typography */
  --font:           'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-size-base: 0.9rem;
}


/* ================================================
   2. Base
   ================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font);
  font-size: var(--font-size-base);
  background-color: var(--content-bg);
  color: #374151;
  margin: 0;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: none;
}


/* ================================================
   3. Layout (Wrapper)
   ================================================ */
#wrapper {
  display: flex;
  min-height: 100vh;
}

#content-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-width);
  transition: margin-left 0.25s ease;
}

#content {
  flex: 1;
}


/* ================================================
   4. Sidebar
   ================================================ */
.sidebar {
  width: var(--sidebar-width);
  min-height: 100vh;
  background: linear-gradient(180deg, var(--sidebar-bg) 0%, var(--sidebar-dark) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100%;
  z-index: 1000;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.25s ease;

  /* custom scrollbar */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
}

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

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

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

/* Brand / Logo */
.sidebar-brand {
  display: flex !important;
  align-items: center;
  min-height: var(--sidebar-brand-h);
  padding: 0 1.25rem;
  color: #ffffff !important;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  background: rgba(0, 0, 0, 0.25);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  text-decoration: none !important;
  flex-shrink: 0;
}

.sidebar-brand:hover {
  color: #ffffff !important;
  background: rgba(0, 0, 0, 0.35);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--primary);
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.75rem;
  font-size: 1rem;
  color: #fff;
  flex-shrink: 0;
}

.sidebar-brand-text {
  font-size: 0.95rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Divider */
.sidebar-divider {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  margin: 0.5rem 1rem;
}

/* Section heading */
.sidebar-heading {
  padding: 0.75rem 1.25rem 0.3rem;
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
}

/* Nav items */
.sidebar .nav-item {
  width: 100%;
}

.sidebar .nav-item .nav-link {
  display: flex;
  align-items: center;
  padding: 0.65rem 1.25rem;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  font-weight: 600;
  border-left: 3px solid transparent;
  transition: all 0.18s ease;
  text-decoration: none;
  white-space: nowrap;
}

.sidebar .nav-item .nav-link:hover {
  color: #ffffff;
  background: var(--sidebar-hover);
  border-left-color: var(--primary);
}

.sidebar .nav-item.active .nav-link,
.sidebar .nav-item .nav-link.active {
  color: #ffffff;
  background: rgba(37, 99, 235, 0.18);
  border-left-color: var(--primary);
}

.sidebar .nav-item .nav-link i,
.sidebar .nav-item .nav-link .fas,
.sidebar .nav-item .nav-link .far,
.sidebar .nav-item .nav-link .fab {
  width: 1.1rem;
  margin-right: 0.625rem;
  font-size: 0.85rem;
  text-align: center;
  flex-shrink: 0;
}

/* Sidebar toggle button */
#sidebarToggle {
  width: 2rem;
  height: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  cursor: pointer;
  border: none;
  margin: 1rem auto;
  display: block;
  transition: background 0.2s ease;
}

#sidebarToggle:hover {
  background: rgba(255, 255, 255, 0.2);
}


/* ================================================
   5. Topbar
   ================================================ */
.topbar {
  height: var(--topbar-h);
  background: #ffffff !important;
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 900;
  padding: 0 1.5rem;
}

.topbar .navbar-nav .nav-link {
  padding: 0 0.75rem;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  color: #4B5563;
  font-weight: 600;
  font-size: 0.875rem;
}

.topbar .navbar-nav .nav-link:hover {
  color: var(--primary);
}

/* User avatar circle */
.topbar .user-avatar {
  width: 36px;
  height: 36px;
  background: var(--primary-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-weight: 700;
  font-size: 0.85rem;
}

/* Topbar dropdown */
.topbar .dropdown-menu {
  border: none;
  border-radius: var(--card-radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 0.5rem 0;
  min-width: 200px;
  margin-top: 0.25rem;
}

.topbar .dropdown-header {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.25rem;
}

.topbar .dropdown-header .user-name {
  font-weight: 700;
  font-size: 0.875rem;
  color: #1E293B;
}

.topbar .dropdown-header .user-role {
  font-size: 0.75rem;
  color: var(--secondary);
}

.topbar .dropdown-item {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  transition: background 0.15s ease;
}

.topbar .dropdown-item:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.topbar .dropdown-item.text-danger:hover {
  background: #FEF2F2;
  color: var(--danger) !important;
}

.topbar .dropdown-divider {
  margin: 0.25rem 0;
  border-color: var(--border-color);
}


/* ================================================
   6. Content Area
   ================================================ */
.container-fluid {
  padding: 1.5rem;
}

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

.page-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: #1E293B;
  margin: 0;
}

.breadcrumb {
  background: none;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
}

.breadcrumb-item.active {
  color: var(--secondary);
}


/* ================================================
   7. Cards
   ================================================ */
.card {
  border: 1px solid var(--border-color);
  border-radius: var(--card-radius);
  box-shadow: var(--card-shadow);
  background: #ffffff;
  margin-bottom: 1.5rem;
}

.card-header {
  background: #ffffff;
  border-bottom: 1px solid var(--border-color);
  padding: 0.875rem 1.25rem;
  font-weight: 700;
  font-size: 0.9rem;
  color: #1E293B;
  border-radius: calc(var(--card-radius) - 1px) calc(var(--card-radius) - 1px) 0 0 !important;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-body {
  padding: 1.25rem;
}

/* Stat cards */
.card-stat {
  border: none;
  border-left: 4px solid var(--primary);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.card-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.card-stat.success { border-left-color: var(--success); }
.card-stat.warning { border-left-color: var(--warning); }
.card-stat.danger  { border-left-color: var(--danger);  }
.card-stat.info    { border-left-color: var(--info);    }

.card-stat .stat-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--secondary);
}

.card-stat .stat-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: #1E293B;
  line-height: 1.2;
}

.card-stat .stat-icon {
  font-size: 2rem;
  color: #D1D5DB;
}


/* ================================================
   8. Forms
   ================================================ */
.form-group label,
.form-label {
  font-weight: 700;
  font-size: 0.8rem;
  color: #4B5563;
  margin-bottom: 0.375rem;
  display: block;
}

.form-control {
  height: auto;
  padding: 0.5rem 0.875rem;
  font-size: var(--font-size-base);
  font-family: var(--font);
  color: #374151;
  border: 1px solid #D1D5DB;
  border-radius: 0.4rem;
  background: #ffffff;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  outline: none;
}

.form-control::placeholder {
  color: #9CA3AF;
}

.form-control.is-invalid {
  border-color: var(--danger);
}

.form-control.is-invalid:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

select.form-control {
  cursor: pointer;
}

/* Input with icon */
.input-icon-wrap {
  position: relative;
}

.input-icon-wrap .form-control {
  padding-left: 2.5rem;
}

.input-icon-wrap .input-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9CA3AF;
  font-size: 0.875rem;
  pointer-events: none;
}

.input-icon-wrap .input-icon-right {
  position: absolute;
  right: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9CA3AF;
  font-size: 0.875rem;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  line-height: 1;
}

.input-icon-wrap .input-icon-right:hover {
  color: #4B5563;
}


/* ================================================
   9. Buttons
   ================================================ */
.btn {
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: 0.4rem;
  padding: 0.5rem 1.125rem;
  transition: all 0.18s ease;
  border-width: 1px;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
  transform: translateY(-1px);
}

.btn-secondary {
  background: #F1F5F9;
  border-color: var(--border-color);
  color: #374151;
}

.btn-secondary:hover {
  background: #E2E8F0;
  border-color: #CBD5E1;
  color: #1E293B;
}

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #ffffff;
}

.btn-danger:hover {
  background: #B91C1C;
  border-color: #B91C1C;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.3);
  transform: translateY(-1px);
}

.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}

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

.btn-sm {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
}

.btn-icon {
  padding: 0.4rem 0.6rem;
  line-height: 1;
}

/* Login submit button */
.btn-login {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  font-weight: 800;
  border-radius: 0.5rem;
  background: var(--primary);
  border: none;
  color: #ffffff;
  transition: all 0.2s ease;
}

.btn-login:hover {
  background: var(--primary-dark);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.35);
}

.btn-login:active {
  transform: translateY(0);
}


/* ================================================
   10. Tables
   ================================================ */
.table-card .card-body {
  padding: 0;
}

.table {
  margin-bottom: 0;
  font-size: 0.875rem;
  color: #374151;
}

.table thead th {
  background: #F8FAFC;
  border-top: none;
  border-bottom: 2px solid var(--border-color);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary);
  padding: 0.75rem 1rem;
  white-space: nowrap;
}

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

.table tbody tr {
  transition: background 0.12s ease;
}

.table tbody tr:hover {
  background: #F8FAFC;
}

.table-action-col {
  width: 100px;
  text-align: center;
}


/* ================================================
   11. Badges & Alerts
   ================================================ */
.badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.3em 0.65em;
  border-radius: 0.3rem;
  letter-spacing: 0.02em;
}

.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-success { background: #D1FAE5; color: #065F46; }
.badge-warning { background: #FEF3C7; color: #92400E; }
.badge-danger  { background: #FEE2E2; color: #991B1B; }
.badge-info    { background: #E0F2FE; color: #075985; }
.badge-secondary { background: #F1F5F9; color: var(--secondary); }

.alert {
  border: none;
  border-left: 4px solid;
  border-radius: var(--card-radius);
  font-size: 0.875rem;
  font-weight: 600;
  padding: 0.875rem 1.125rem;
}

.alert-success { border-left-color: var(--success); background: #ECFDF5; color: #065F46; }
.alert-danger  { border-left-color: var(--danger);  background: #FEF2F2; color: #991B1B; }
.alert-warning { border-left-color: var(--warning); background: #FFFBEB; color: #92400E; }
.alert-info    { border-left-color: var(--info);    background: #F0F9FF; color: #075985; }


/* ================================================
   12. Scroll-to-Top & Footer
   ================================================ */
.scroll-to-top {
  position: fixed;
  right: 1.5rem;
  bottom: 1.5rem;
  width: 2.5rem;
  height: 2.5rem;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  opacity: 0;
  visibility: hidden;
  transition: all 0.25s ease;
  z-index: 999;
  font-size: 0.875rem;
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
}

.scroll-to-top:hover {
  color: #ffffff;
  background: var(--primary-dark);
  transform: translateY(-2px);
}

.sticky-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  background: #ffffff;
  font-size: 0.8rem;
  color: var(--secondary);
}


/* ================================================
   13. Login Page
   ================================================ */
body.login-page {
  background: linear-gradient(135deg, #0F172A 0%, #1E3A8A 50%, #2563EB 100%);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.login-wrapper {
  width: 100%;
  max-width: 430px;
}

.login-card {
  background: #ffffff;
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35);
}

.login-card-header {
  background: linear-gradient(135deg, #0F172A 0%, #2563EB 100%);
  padding: 2.25rem 2rem;
  text-align: center;
}

.login-app-icon {
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 0.875rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 1.25rem;
  font-size: 1.75rem;
  color: #ffffff;
  backdrop-filter: blur(4px);
}

.login-card-header h4 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.25rem;
}

.login-card-header p {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.login-card-body {
  padding: 2rem;
}

.login-card-body .form-group {
  margin-bottom: 1.25rem;
}

.login-card-footer {
  padding: 1rem 2rem;
  background: #F8FAFC;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.8rem;
  color: var(--secondary);
}

/* Spinner saat submit */
.btn-login .spinner {
  display: none;
}

.btn-login.loading .btn-text {
  display: none;
}

.btn-login.loading .spinner {
  display: inline-block;
}


/* ================================================
   14. Error Pages
   ================================================ */
body.error-page {
  background: var(--content-bg);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-container {
  text-align: center;
  padding: 2rem;
  max-width: 480px;
}

.error-code {
  font-size: 7rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--primary) 0%, var(--info) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.error-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #1E293B;
  margin: 0.75rem 0 0.5rem;
}

.error-desc {
  color: var(--secondary);
  font-size: 0.925rem;
  margin-bottom: 2rem;
}

.error-icon {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
  color: var(--secondary);
}


/* ================================================
   15. Responsive
   ================================================ */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

  .sidebar.toggled {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.25);
  }

  #content-wrapper {
    margin-left: 0;
  }

  .container-fluid {
    padding: 1rem;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 576px) {
  .login-card-header {
    padding: 1.75rem 1.5rem;
  }

  .login-card-body {
    padding: 1.5rem;
  }

  .login-card-footer {
    padding: 0.875rem 1.5rem;
  }
}
