/* ============================================
   STYLE.CSS — Global Styles + Layout chính
   Mitalab Product Evaluation Tracker
   ============================================ */

/* ---- CSS Variables ---- */
:root {
  --primary:        #1976D2;
  --primary-dark:   #1565C0;
  --primary-light:  #BBDEFB;
  --accent:         #FF6F00;
  --success:        #2E7D32;
  --warning:        #F57F17;
  --danger:         #C62828;
  --text-primary:   #212121;
  --text-secondary: #757575;
  --text-white:     #FFFFFF;
  --bg-page:        #F5F7FA;
  --bg-white:       #FFFFFF;
  --border:         #E0E0E0;
  --shadow-sm:      0 1px 3px rgba(0,0,0,.12);
  --shadow-md:      0 4px 12px rgba(0,0,0,.15);
  --sidebar-w:      250px;
  --header-h:       60px;
  --radius:         8px;
  --transition:     .2s ease;
}

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

html, body {
  height: 100%;
  font-family: 'Segoe UI', 'Roboto', Arial, sans-serif;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-page);
  line-height: 1.5;
}

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

button { cursor: pointer; border: none; outline: none; }

input, select, textarea {
  font-family: inherit;
  font-size: 14px;
}

/* ---- Utility ---- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-muted { color: var(--text-secondary); }

/* ============================================
   APP SHELL — 2 vùng: #sidebar + #main-content
   ============================================ */
#app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   SIDEBAR
   ============================================ */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--primary-dark);
  display: flex;
  flex-direction: column;
  transition: transform var(--transition);
  z-index: 200;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Logo / Brand */
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  min-height: var(--header-h);
}

.sidebar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.sidebar-brand .brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand .brand-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
  line-height: 1.2;
}

.sidebar-brand .brand-sub {
  font-size: 10px;
  color: rgba(255,255,255,.6);
}

/* Nav Menu */
.sidebar-nav {
  flex: 1;
  padding: 12px 0;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 20px;
  color: rgba(255,255,255,.8);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-left: 3px solid transparent;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255,255,255,.1);
  color: var(--text-white);
}

.nav-item.active {
  background: rgba(255,255,255,.15);
  color: var(--text-white);
  border-left-color: var(--accent);
}

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

/* Logout button ở cuối sidebar */
.sidebar-footer {
  padding: 12px 0;
  border-top: 1px solid rgba(255,255,255,.1);
}

.sidebar-footer .nav-item {
  color: rgba(255,255,255,.6);
}

.sidebar-footer .nav-item:hover {
  color: #EF9A9A;
  background: rgba(198,40,40,.15);
}

/* ============================================
   MAIN CONTENT AREA
   ============================================ */
#main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* Header */
#app-header {
  height: var(--header-h);
  background: var(--bg-white);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
  z-index: 100;
}

/* Hamburger — chỉ hiện trên mobile */
#hamburger-btn {
  display: none;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-secondary);
  padding: 4px;
  line-height: 1;
}

#page-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  flex: 1;
}

/* User info trong header */
.header-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--text-white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.user-info {
  display: flex;
  flex-direction: column;
  text-align: right;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
}

.user-role {
  font-size: 11px;
  color: var(--text-secondary);
}

/* Content vùng cuộn */
#page-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
}

/* ============================================
   OVERLAY — che nền khi sidebar mở trên mobile
   ============================================ */
#sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 150;
}

/* ============================================
   PLACEHOLDER PAGES
   ============================================ */
.placeholder-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 60vh;
  gap: 16px;
  color: var(--text-secondary);
}

.placeholder-page .placeholder-icon {
  font-size: 64px;
  line-height: 1;
}

.placeholder-page h2 {
  font-size: 22px;
  color: var(--text-primary);
}

.placeholder-page p {
  font-size: 14px;
  text-align: center;
  max-width: 400px;
}

.badge-coming {
  display: inline-block;
  background: var(--primary-light);
  color: var(--primary-dark);
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* ============================================
   TOAST NOTIFICATION
   ============================================ */
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.toast {
  min-width: 260px;
  max-width: 380px;
  background: var(--text-primary);
  color: var(--text-white);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  box-shadow: var(--shadow-md);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideIn .25s ease;
}

.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }
.toast.warning { background: var(--warning); }

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

/* ============================================
   LOADING SPINNER TOÀN MÀN HÌNH
   ============================================ */
#global-loading {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9998;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--primary-light);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   RESPONSIVE — Tablet & Mobile
   ============================================ */
@media (max-width: 768px) {
  /* Sidebar ẩn ra ngoài màn hình */
  #sidebar {
    position: fixed;
    top: 0;
    left: 0;
    transform: translateX(-100%);
    box-shadow: var(--shadow-md);
  }

  /* Khi sidebar mở: class .open thêm vào #sidebar */
  #sidebar.open {
    transform: translateX(0);
  }

  /* Overlay hiện khi sidebar mở */
  #sidebar-overlay.visible {
    display: block;
  }

  /* Hamburger hiện trên mobile */
  #hamburger-btn {
    display: block;
  }

  /* User info thu gọn */
  .user-info {
    display: none;
  }

  #page-content {
    padding: 16px;
  }
}
