/**
 * ThikKoro - Layout Styles (Public and Admin)
 */

/* =====================================================================
   PUBLIC WEBSITE LAYOUT
   ===================================================================== */
.public-header {
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0.85rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
}

.brand-logo img {
  height: 44px;
  width: auto;
  object-fit: contain;
}

.public-nav {
  display: flex;
  align-items: center;
  gap: 1.75rem;
  list-style: none;
}

.public-nav a {
  font-weight: 600;
  color: var(--color-text-main);
  font-size: 0.95rem;
  transition: color var(--transition-fast);
}

.public-nav a:hover, .public-nav a.active {
  color: var(--color-primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.public-footer {
  background-color: #0b1329;
  color: #94a3b8;
  padding: 4rem 1.5rem 2rem;
  margin-top: 4rem;
}

.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.2fr 1.6fr;
  gap: 2.5rem;
  padding-bottom: 3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-logo {
  height: 42px;
  width: auto;
  margin-bottom: 1rem;
}

.footer-title {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
}

.footer-links {
  list-style: none;
}

.footer-links li {
  margin-bottom: 0.65rem;
}

.footer-links a {
  color: #94a3b8;
  font-size: 0.925rem;
}

.footer-links a:hover {
  color: #ffffff;
}

.footer-bottom {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: #64748b;
}

@media (max-width: 900px) {
  .footer-inner {
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
  }
}

@media (max-width: 600px) {
  .footer-inner {
    grid-template-columns: 1fr;
  }
  .public-nav {
    display: none;
  }
}

/* =====================================================================
   ADMIN & STAFF DASHBOARD LAYOUT & RESPONSIVE DRAWER
   ===================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
  width: 100%;
}

.app-sidebar {
  width: 260px;
  background-color: #0b1329;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1000;
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1), width 0.28s ease;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.12);
}

.sidebar-brand {
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-brand-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

/* Sidebar action toggle button inside sidebar brand */
.sidebar-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  transition: all 0.2s ease;
}

.sidebar-action-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

/* Sidebar Backdrop for Mobile Overlay */
.sidebar-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 990;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

/* Sidebar toggle button in topbar */
.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-md);
  background: var(--color-surface-muted, #f1f5f9);
  color: var(--color-text-main, #0f172a);
  border: 1px solid var(--color-border, #e2e8f0);
  cursor: pointer;
  font-size: 1.15rem;
  line-height: 1;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.sidebar-toggle-btn:hover {
  background: #e2e8f0;
  color: var(--color-primary, #0a56f0);
  border-color: #cbd5e1;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.85rem;
}

.nav-section-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  padding: 0.75rem 0.75rem 0.35rem;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.625rem 0.85rem;
  color: #94a3b8;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  margin-bottom: 0.2rem;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.sidebar-icon {
  width: 18px;
  height: 18px;
  stroke-width: 1.9;
  color: #94a3b8;
  flex-shrink: 0;
  transition: all var(--transition-fast);
}

.sidebar-link:hover {
  color: #ffffff;
  background-color: rgba(255, 255, 255, 0.08);
}

.sidebar-link:hover .sidebar-icon {
  color: #ffffff;
  transform: scale(1.08);
}

.sidebar-link.active {
  color: #ffffff;
  background: linear-gradient(135deg, #0a56f0 0%, #1d4ed8 100%);
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(10, 86, 240, 0.35);
}

.sidebar-link.active .sidebar-icon {
  color: #ffffff;
}

.sidebar-badge {
  margin-left: auto;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-full);
  background-color: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.sidebar-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.sidebar-logout-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm, 6px);
  color: #f87171;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.25);
  transition: all 0.2s ease;
  text-decoration: none;
  cursor: pointer;
  flex-shrink: 0;
}

.sidebar-logout-btn:hover {
  background: #ef4444;
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.3);
}

.user-avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-full);
  background-color: var(--color-primary);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  min-width: 0;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 600;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-badge {
  font-size: 0.725rem;
  color: #94a3b8;
  text-transform: capitalize;
}

.app-main {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-width: 0;
  background-color: var(--color-bg);
  transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-topbar {
  height: 64px;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(226, 232, 240, 0.9);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.02), 0 4px 12px -2px rgba(15, 23, 42, 0.03);
}

.topbar-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-title-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.topbar-page-title {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.topbar-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-full);
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1;
}

.topbar-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.25);
  animation: topbarDotPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes topbarDotPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.9); }
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.topbar-user-pill {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  border-radius: var(--radius-full);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}

.topbar-user-pill .user-avatar-circle {
  width: 32px;
  height: 32px;
  font-size: 0.8rem;
}

.topbar-user-name {
  font-size: 0.825rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-text-main);
}

.topbar-user-role {
  font-size: 0.7rem;
  color: var(--color-text-muted);
  text-transform: capitalize;
  line-height: 1.1;
}

.content-body {
  padding: 1.75rem;
  flex: 1;
  min-width: 0;
}

/* Responsive Split Grids for Admin Pages */
.admin-split-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-split-grid-reverse {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

/* =====================================================================
   EXPAND / CLOSE RESPONSIVE BEHAVIOR
   ===================================================================== */
/* Desktop Mode (> 992px) */
@media (min-width: 993px) {
  .icon-close-mobile {
    display: none !important;
  }
  .icon-collapse-desktop {
    display: inline-block !important;
  }

  /* When admin toggles sidebar closed/collapsed on desktop */
  body.sidebar-collapsed .app-sidebar {
    transform: translateX(-100%);
  }
  body.sidebar-collapsed .app-main {
    margin-left: 0;
  }
}

/* Mobile & Tablet Mode (<= 992px) */
@media (max-width: 992px) {
  .icon-close-mobile {
    display: inline-block !important;
  }
  .icon-collapse-desktop {
    display: none !important;
  }

  .app-sidebar {
    transform: translateX(-100%);
    width: 280px;
    max-width: 85vw;
  }
  .app-sidebar.open {
    transform: translateX(0);
  }
  .app-main {
    margin-left: 0 !important;
  }

  .admin-split-grid,
  .admin-split-grid-reverse {
    grid-template-columns: 1fr;
  }
}
