/* =========================================================
   KOSTPRO FULLSTACK PHP MYSQL
   assets/css/layout.css
   ========================================================= */

:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --dark: #0f172a;
  --soft-bg: #f5f7fb;
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-main: #111827;
  --text-muted: #6b7280;
  --border: #e5e7eb;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--soft-bg);
  color: var(--text-main);
  min-height: 100vh;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at top left, rgba(37,99,235,.24), transparent 34%),
    radial-gradient(circle at bottom right, rgba(14,165,233,.22), transparent 34%),
    #f8fafc;
  padding: 22px;
}

.login-card {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  border-radius: 32px;
  box-shadow: 0 24px 80px rgba(15,23,42,.16);
  background: white;
}

.login-hero {
  background: linear-gradient(150deg, #0f172a, #1e3a8a, #2563eb);
  color: white;
  padding: 46px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-hero h1 {
  font-size: 38px;
  font-weight: 900;
  margin-bottom: 12px;
}

.login-hero p {
  color: rgba(255,255,255,.78);
  line-height: 1.7;
}

.login-form {
  padding: 46px;
}

.demo-box {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 18px;
  padding: 14px;
  font-size: 13px;
  color: #475569;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, #0f172a 0%, #111827 58%, #1e293b 100%);
  color: white;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 50;
  padding: 22px;
}

.brand-box {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 18px;
  background: var(--primary);
  display: grid;
  place-items: center;
  font-size: 24px;
}

.brand-box h1 {
  font-size: 20px;
  font-weight: 900;
  margin: 0;
}

.brand-box small,
.user-panel small {
  color: rgba(255,255,255,.68);
}

.user-panel {
  background: rgba(255,255,255,.08);
  border-radius: 22px;
  padding: 16px;
  margin-bottom: 20px;
}

.user-panel b {
  display: block;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  color: rgba(255,255,255,.76);
  text-decoration: none;
  transition: .2s ease;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 14px;
}

.sidebar-link:hover,
.sidebar-link.active {
  color: white;
  background: rgba(37,99,235,.95);
  transform: translateX(3px);
}

.main-content {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(245,247,251,.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 16px 34px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
}

.topbar h2 {
  font-size: 24px;
  font-weight: 900;
  margin: 0;
}

.topbar small {
  color: var(--text-muted);
}

.page-wrapper {
  padding: 28px 34px;
}

.mobile-overlay {
  display: none;
}

.glass-card {
  background: var(--card-bg);
  border: 1px solid rgba(229,231,235,.9);
  border-radius: 24px;
  box-shadow: 0 18px 45px rgba(15,23,42,.06);
  padding: 24px;
}

.glass-card h5,
.glass-card h4 {
  font-weight: 900;
}

.stat-card small,
.text-muted-label {
  color: var(--text-muted);
  font-weight: 700;
}

.stat-card h3 {
  font-weight: 900;
  margin: 10px 0 4px;
}

.header-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 22px;
}

.header-card p {
  color: var(--text-muted);
  margin: 0;
}

.view-section {
  display: none;
}

.view-section.active {
  display: block;
  animation: fadeIn .22s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.badge-soft {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.badge-success { background: #dcfce7; color: #166534; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1d4ed8; }
.badge-dark-soft { background: #e2e8f0; color: #0f172a; }
.role-super_admin { background: #ede9fe; color: #5b21b6; }
.role-admin { background: #dbeafe; color: #1d4ed8; }
.role-tenant { background: #dcfce7; color: #166534; }

.table>:not(caption)>*>* {
  padding: 14px 12px;
  vertical-align: middle;
}

.summary-line {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  gap: 12px;
}

.summary-line span {
  color: var(--text-muted);
}

.action-card {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 18px;
  background: #f8fafc;
}

.action-card i {
  font-size: 26px;
  color: var(--primary);
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 999px;
  background: var(--primary);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
}

.form-hint {
  color: var(--text-muted);
  font-size: 13px;
}

.only-super-admin {
  display: none !important;
}

body.is-super-admin .only-super-admin {
  display: flex !important;
}

body.is-super-admin tr.only-super-admin {
  display: table-row !important;
}

.restricted-box {
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  color: #64748b;
  border-radius: 18px;
  padding: 18px;
}

.loading-box {
  padding: 26px;
  text-align: center;
  color: var(--text-muted);
}

@media (max-width: 1024px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: -290px;
    width: 280px;
    transition: left .25s ease;
  }

  .sidebar.open {
    left: 0;
  }

  .mobile-overlay.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 45;
  }

  .topbar,
  .page-wrapper {
    padding-inline: 20px;
  }
}

@media (max-width: 768px) {
  .login-card {
    grid-template-columns: 1fr;
  }

  .login-hero,
  .login-form {
    padding: 28px;
  }

  .login-hero h1 {
    font-size: 30px;
  }

  .header-card {
    flex-direction: column;
    align-items: stretch;
  }

  .glass-card {
    border-radius: 18px;
    padding: 18px;
  }

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