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

:root {
  --primary-50: #e7eff3;
  --primary-100: #b5cdd8;
  --primary-500: #1d536c;
  --primary-600: #174257;
  --primary-800: #0e2d3d;
  --primary-900: #06161f;

  --gold-400: #f6ca66;
  --gold-500: #eeb700;
  --gold-600: #d7b24c;

  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --info: #3b82f6;
  --info-bg: rgba(59, 130, 246, 0.12);

  --bg-app: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #ffffff;
  --bg-sidebar: #1d536c;
  --bg-glass: rgba(255, 255, 255, 0.95);
  --border-glass: rgba(0, 59, 70, 0.1);
  --border-subtle: #e2e8f0;

  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-sidebar: #1d536c;
  --text-sidebar: #e2e8f0;
  --text-sidebar-active: #ffffff;
  --text-inverse: #ffffff;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glass: 0 4px 6px rgba(0, 0, 0, 0.05);

  --header-height: 72px;
  --sidebar-width: 270px;
  --sidebar-collapsed-width: 80px;

  --font-heading: 'Poppins', sans-serif;
  --font-body: 'Poppins', sans-serif;

  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-app: #0b1319;
  --bg-surface: #121e27;
  --bg-surface-elevated: #1a2a37;
  --bg-sidebar: #071017;
  --bg-glass: rgba(18, 30, 39, 0.75);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-subtle: #1e2d3d;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-inverse: #0f172a;
  --text-sidebar: #64748b;

  --shadow-glass: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-md: 0 6px 16px rgba(0, 0, 0, 0.3);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-app);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

#app-wrapper { display: flex; min-height: 100vh; width: 100vw; }

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--transition-normal);
  overflow-y: auto;
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-logo { display: flex; align-items: center; gap: 0.75rem; color: #fff; }

.sidebar-nav {
  padding: 1.5rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.nav-section-title {
  color: #94a3b8;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.5rem 0.75rem 0.25rem 0.75rem;
  margin-top: 1rem;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 1rem;
  color: var(--text-sidebar);
  font-weight: 500;
  font-size: 1rem;
  border-radius: 10px;
  transition: all var(--transition-fast);
  position: relative;
}

.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

.nav-item.active {
  color: #fff;
  background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-500) 100%);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 15%; bottom: 15%;
  width: 4px;
  background: var(--gold-500);
  border-radius: 0 4px 4px 0;
}

.sidebar-footer {
  padding: 1.25rem 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.user-profile-summary { display: flex; align-items: center; gap: 0.75rem; }
.avatar-circle {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-500), #e18e12);
  color: #fff; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.user-info { display: flex; flex-direction: column; overflow: hidden; }
.user-name { color: #fff; font-weight: 600; font-size: 0.875rem; }
.user-role { color: var(--gold-400); font-size: 0.75rem; }

.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  transition: margin-left var(--transition-normal);
  background-color: var(--bg-app);
}

.app-header {
  height: var(--header-height);
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0; z-index: 90;
  box-shadow: var(--shadow-sm);
}

.header-left, .header-right { display: flex; align-items: center; gap: 1rem; }

.sidebar-toggle-btn, .icon-btn {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
}

.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border-subtle);
  background: var(--bg-surface); color: var(--text-main);
}
.icon-btn:hover { background: var(--bg-app); color: var(--primary-500); }

.content-body { padding: 2rem; flex: 1; max-width: 1400px; width: 100%; margin: 0 auto; }

.app-footer {
  padding: 1.5rem 2rem;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 0.85rem; color: var(--text-muted); margin-top: auto;
}

.glass-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 8px; padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.65rem 1.25rem; font-size: 0.875rem; font-weight: 600; border-radius: 10px;
  cursor: pointer; transition: all var(--transition-fast); border: 1px solid transparent;
}
.btn-primary { background: linear-gradient(135deg, var(--primary-800) 0%, var(--primary-600) 100%); color: #fff; }
.btn-gold { background: linear-gradient(135deg, var(--gold-500) 0%, #d4af37 100%); color: #fff; }
.btn-outline { background: transparent; border-color: var(--border-subtle); color: var(--text-main); }
.btn-sm { padding: 0.4rem 0.85rem; font-size: 0.8rem; border-radius: 8px; }

.badge { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.25rem 0.75rem; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-gold { background: rgba(197, 155, 39, 0.15); color: var(--gold-500); }

body.sidebar-collapsed .app-sidebar { width: var(--sidebar-collapsed-width); }
body.sidebar-collapsed .app-main { margin-left: var(--sidebar-collapsed-width); }
body.sidebar-collapsed .nav-item span, body.sidebar-collapsed .nav-section-title, body.sidebar-collapsed .user-info { display: none; }

@media (max-width: 1024px) {
  .app-sidebar { transform: translateX(-100%); width: 270px !important; }
  body.sidebar-open .app-sidebar { transform: translateX(0); }
  .app-main { margin-left: 0 !important; }
}

/* PUBLIC LAYOUT (EduMart Style) */
.public-layout .app-main { margin-left: 0; padding-top: 0; }
.public-layout .content-body { max-width: 100%; padding: 0; }
.public-layout .app-sidebar { display: none; }

/* Top Navigation Bar */
.public-navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 80px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4rem;
  z-index: 1000;
  border-bottom: 1px solid var(--border-subtle);
}

.public-navbar .nav-brand {
  display: flex; align-items: center; gap: 1rem;
}
.public-navbar .nav-brand img { height: 48px; }

.public-navbar .nav-menu {
  display: flex; align-items: center; gap: 2rem;
}

.public-navbar .nav-menu a {
  font-weight: 600;
  color: var(--text-main);
  transition: color var(--transition-fast);
  position: relative;
}

.public-navbar .nav-menu a:hover, .public-navbar .nav-menu a.active { color: var(--gold-500); }
.public-navbar .nav-menu a.active::after { content: ''; position: absolute; bottom: -4px; left: 0; width: 100%; height: 2px; background: var(--gold-500); }

/* Dropdown Menu */
.nav-dropdown { position: relative; display: inline-block; }
.nav-dropdown-menu {
  display: none; position: absolute; top: 100%; left: 0;
  background: var(--bg-surface); min-width: 240px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1); border-radius: 8px;
  padding: 0.5rem 0; z-index: 100;
  border: 1px solid var(--border-color);
}
.nav-dropdown:hover .nav-dropdown-menu { display: block; animation: fadeIn 0.2s ease-in-out; }
.nav-dropdown-menu a {
  display: block; padding: 0.75rem 1.25rem; font-size: 0.95rem; font-weight: 500;
}
.nav-dropdown-menu a:hover { background: var(--bg-app); color: var(--primary-600); }
.nav-dropdown-menu a.active::after { display: none; }
.nav-dropdown-menu a.active { color: var(--primary-600); background: rgba(0, 43, 54, 0.05); }

.nav-actions { display: flex; align-items: center; gap: 1rem; margin-left: auto; }

/* Public Footer */
.public-footer {
  background: var(--bg-sidebar);
  color: rgba(255, 255, 255, 0.7);
  padding: 4rem 4rem 2rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.5fr;
  gap: 3rem;
  margin-bottom: 3rem;
}

.footer-widget h4 {
  color: #fff;
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
  position: relative;
  padding-bottom: 0.5rem;
}

.footer-widget h4::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0;
  width: 40px; height: 2px;
  background: var(--gold-500);
}

.footer-widget p { font-size: 0.9rem; line-height: 1.7; margin-bottom: 1rem; }

.footer-links { list-style: none; }
.footer-links li { margin-bottom: 0.75rem; }
.footer-links a { transition: color var(--transition-fast); }
.footer-links a:hover { color: var(--gold-500); padding-left: 4px; }

.footer-bottom {
  text-align: center;
  padding-top: 2rem;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.85rem;
}

@media (max-width: 1024px) {
  .public-navbar { padding: 0 2rem; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .public-navbar .nav-menu { display: none; } /* Simplified for now */
  .footer-grid { grid-template-columns: 1fr; }
}
