/* ── eco User Portal Common Layout ── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; background: #0f1117; color: #f1f5f9; height: 100vh; display: flex; overflow: hidden; }

/* ── 사이드바 ── */
.sidebar { width: 220px; background: #13161f; border-right: 1px solid #1f2232; display: flex; flex-direction: column; flex-shrink: 0; }
.sidebar-logo { padding: 20px 16px 14px; font-size: 20px; font-weight: 700; color: #f1f5f9; border-bottom: 1px solid #1f2232; cursor: pointer; }
.sidebar-logo span { color: #6366f1; }
.btn-new-chat { margin: 12px 12px 0; padding: 10px 14px; background: #6366f1; color: #fff; border: none; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 8px; text-decoration: none; }
.btn-new-chat:hover { background: #5254cc; }
.chat-list { flex: 1; overflow-y: auto; padding: 8px 6px; }
.chat-section-title { padding: 10px 10px 4px; font-size: 11px; color: #475569; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.chat-item { padding: 9px 10px; border-radius: 7px; cursor: pointer; margin-bottom: 2px; }
.chat-item:hover { background: #1a1d2e; }
.chat-item.active { background: #1e2235; }
.chat-item-title { font-size: 13px; color: #cbd5e1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item-meta { font-size: 11px; color: #475569; margin-top: 2px; }
.sidebar-nav { border-top: 1px solid #1f2232; padding: 8px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: #94a3b8; text-decoration: none; transition: background 0.15s, color 0.15s; white-space: nowrap; overflow: hidden; }
.nav-item:hover { background: #1a1d2e; color: #f1f5f9; }
.nav-item.active { background: #1e2235; color: #f1f5f9; }
.sidebar-bottom { border-top: 1px solid #1f2232; padding: 8px 6px; }
.sidebar-user { padding: 10px; display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 32px; height: 32px; background: linear-gradient(135deg, #6366f1, #10b981); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: 13px; font-weight: 600; color: #e2e8f0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-group { font-size: 11px; color: #475569; }

/* ── 메인 ── */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.page-header { padding: 18px 24px; border-bottom: 1px solid #1f2232; display: flex; align-items: center; justify-content: space-between; flex-shrink: 0; }
.page-header h1 { font-size: 16px; font-weight: 700; color: #f1f5f9; }
.page-header p { font-size: 12px; color: #475569; margin-top: 2px; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ── 공통 컴포넌트 ── */
.btn { padding: 8px 16px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer; border: none; transition: background 0.2s; }
.btn-primary { background: #6366f1; color: #fff; }
.btn-primary:hover { background: #5254cc; }
.btn-secondary { background: #1f2232; color: #94a3b8; border: 1px solid #2a2d3e; }
.btn-secondary:hover { background: #252840; color: #e2e8f0; }
.card { background: #1a1d27; border: 1px solid #2a2d3e; border-radius: 12px; }
.section-title { font-size: 12px; font-weight: 600; color: #475569; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 12px; }
.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.form-label { font-size: 12px; font-weight: 600; color: #94a3b8; }
.form-input, .form-textarea, .form-select { background: #12151f; border: 1px solid #2a2d3e; border-radius: 8px; padding: 9px 12px; color: #e2e8f0; font-size: 13px; outline: none; font-family: inherit; transition: border-color 0.2s; }
.form-input:focus, .form-textarea:focus { border-color: #6366f1; }
.form-textarea { resize: vertical; line-height: 1.6; }

/* ── 햄버거 & 테마 ── */
.sidebar-wrap { position: relative; display: flex; flex-shrink: 0; }
.hamburger-btn { position: absolute; top: 14px; right: -13px; width: 26px; height: 26px; background: #1f2232; border: 1px solid #2a2d3e; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 10px; color: #94a3b8; z-index: 200; transition: all 0.15s; box-shadow: 0 2px 6px rgba(0,0,0,0.3); }
.hamburger-btn:hover { color: #f1f5f9; border-color: #6366f1; background: #1a1d2e; }
.sidebar { transition: width 0.25s ease; overflow: hidden; }
.sidebar.collapsed { width: 52px !important; }
.sidebar.collapsed .nav-label, .sidebar.collapsed .user-info, .sidebar.collapsed .chat-section-title, .sidebar.collapsed .chat-item-meta, .sidebar.collapsed .chat-item-title, .sidebar.collapsed [style*="padding:4px 6px"] { display: none !important; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 14px 6px; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 9px 0; }
.sidebar.collapsed .user-avatar { margin: 0 auto; }
.sidebar.collapsed .sidebar-user { justify-content: center; padding: 10px 0; }
.theme-btn { position: fixed !important; top: 14px; right: 16px; z-index: 9999; background: linear-gradient(135deg, #6366f1, #8b5cf6); border: none; border-radius: 20px; padding: 6px 14px; font-size: 12px; color: #fff; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; box-shadow: 0 2px 8px rgba(99,102,241,0.4); font-weight: 600; }
.theme-btn:hover { transform: translateY(-1px); }

body.light-mode { background: #f1f5f9 !important; color: #0f172a !important; }
body.light-mode .sidebar { background: #e2e8f0 !important; border-color: #cbd5e1 !important; }
body.light-mode .sidebar-logo { color: #0f172a !important; border-color: #cbd5e1 !important; }
body.light-mode .nav-item { color: #475569 !important; }
body.light-mode .nav-item:hover, body.light-mode .nav-item.active { background: #cbd5e1 !important; color: #0f172a !important; }
body.light-mode .main { background: #f8fafc !important; }
body.light-mode .page-header { border-color: #e2e8f0 !important; background: #f1f5f9 !important; }
body.light-mode .card { background: #fff !important; border-color: #e2e8f0 !important; }
body.light-mode .form-input, body.light-mode .form-textarea { background: #f8fafc !important; border-color: #e2e8f0 !important; color: #0f172a !important; }

@media (max-width: 768px) {
  .sidebar-wrap { position: fixed !important; top: 0; left: 0; height: 100vh; z-index: 500; }
  .sidebar { height: 100vh; overflow-y: auto; box-shadow: 2px 0 16px rgba(0,0,0,0.5); }
  .sidebar.collapsed { width: 220px !important; transform: translateX(-100%) !important; }
  .sidebar:not(.collapsed) { width: 220px !important; transform: translateX(0); }
  .hamburger-btn { position: fixed !important; top: 12px !important; left: 12px !important; right: auto !important; width: 34px !important; height: 34px !important; font-size: 14px !important; z-index: 600 !important; }
  .sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 499; }
  .sidebar-overlay.show { display: block; }
  .main { width: 100% !important; }
  .page-header { padding: 14px 14px 14px 56px !important; }
  .content { padding: 14px !important; }
  .theme-btn { top: 12px !important; right: 12px !important; font-size: 11px !important; padding: 4px 8px !important; }
}
