/**
 * CRM JLS Studio — Base : Reset, Typo, Layout Shell
 */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  font-size: var(--text-sm);
  color: var(--text-primary);
  background-color: var(--bg-primary);
  line-height: 1.6;
  min-height: 100vh;
}

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

a:hover {
  color: var(--accent-hover);
}

img {
  max-width: 100%;
  display: block;
}

/* Typo */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

code, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* Selection */
::selection {
  background: var(--accent);
  color: var(--text-inverse);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-hover);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== Layout Shell ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 50;
  transition: var(--transition-slow);
  overflow-y: auto;
}

.app-sidebar.collapsed {
  width: var(--sidebar-collapsed);
}

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

.sidebar-collapsed .app-main {
  margin-left: var(--sidebar-collapsed);
}

.app-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-6);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-content {
  flex: 1;
  padding: var(--space-6);
  max-width: var(--content-max);
  width: 100%;
  margin: 0 auto;
}

/* ===== Sidebar ===== */
.sidebar-logo {
  padding: var(--space-5) var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
  height: 32px;
  width: auto;
}

.sidebar-logo h1 {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.sidebar-nav {
  padding: var(--space-3) var(--space-2);
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  color: var(--text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  white-space: nowrap;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.nav-item .nav-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  text-align: center;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: white;
  font-size: var(--text-xs);
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-weight: 600;
}

.sidebar-user {
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ===== Header ===== */
.header-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.header-greeting {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.header-greeting strong {
  color: var(--text-primary);
}

/* Search trigger */
.search-trigger {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: var(--text-sm);
  min-width: 240px;
  transition: var(--transition);
}

.search-trigger:hover {
  border-color: var(--border-hover);
  background: var(--bg-hover);
}

.search-trigger kbd {
  margin-left: auto;
  background: var(--bg-primary);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  border: 1px solid var(--border);
}

/* Notifs */
.notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  font-size: var(--text-lg);
}

.notif-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.notif-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 8px;
  height: 8px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

/* Theme toggle */
.theme-toggle {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
  background: none;
  border: none;
  font-size: var(--text-lg);
}

.theme-toggle:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* Page header */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  flex-wrap: wrap;
  gap: var(--space-4);
}

.page-title {
  font-size: var(--text-2xl);
  font-weight: 700;
}

.page-subtitle {
  color: var(--text-secondary);
  font-size: var(--text-sm);
  margin-top: var(--space-1);
}

/* Login page */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-primary);
  padding: var(--space-4);
}

.login-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-10);
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: var(--space-8);
}

.login-logo img {
  height: 48px;
  margin-bottom: var(--space-3);
}

.login-logo h1 {
  font-size: var(--text-xl);
  color: var(--accent);
}

.login-logo p {
  color: var(--text-muted);
  font-size: var(--text-sm);
}
