/* ========================================
   JustBuild Admin - 통합 스타일
   ======================================== */

:root {
  --primary: #3882d3;
  --primary-hover: #2d6bb5;
  --primary-light: rgba(56, 130, 211, 0.15);
  --success: #34a853;
  --error: #e94235;
  --warning: #fbbc04;
  --bg: #f4f4f4;
  --surface: #ffffff;
  --border: #e0e0e0;
  --text-primary: #111;
  --text-secondary: #555;
  --text-muted: #888;
  --gnb-height: 52px;
  --sidebar-width: 240px;
  --radius: 6px;
  --radius-sm: 4px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
  --focus-ring: 0 0 0 3px rgba(56, 130, 211, 0.15);
  --transition: all 0.2s ease;
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Spoqa Han Sans Neo", "pretendard", "Apple SD Gothic Neo", "맑은 고딕", sans-serif;
  background: var(--bg);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* ========================================
   GNB (Global Navigation Bar)
   ======================================== */
.gnb {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--gnb-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.gnb-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.gnb-logo {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.gnb-logo:hover {
  color: var(--primary-hover);
}

.gnb-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.gnb-logout {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  transition: var(--transition);
}

.gnb-logout:hover {
  color: var(--error);
}

.sidebar-toggle {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 8px;
}

/* ========================================
   Sidebar
   ======================================== */
.app-container {
  display: flex;
  margin-top: var(--gnb-height);
  min-height: calc(100vh - var(--gnb-height));
}

.sidebar {
  position: fixed;
  top: var(--gnb-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 900;
  transition: transform 0.3s ease;
}

.sidebar-nav {
  padding: 12px 0;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-heading {
  padding: 12px 20px 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.5px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: var(--transition);
  border-left: 3px solid transparent;
}

.sidebar-link:hover {
  background: var(--bg);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: var(--primary-light);
  color: var(--primary);
  border-left-color: var(--primary);
  font-weight: 500;
}

.sidebar-link i {
  width: 18px;
  text-align: center;
  font-size: 14px;
}

.sidebar-deploy-info {
  padding: 12px 20px;
  font-size: 10px;
  color: var(--text-muted);
  opacity: 0.5;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}

/* ========================================
   Main Content
   ======================================== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-width: 0;
  overflow-x: auto;
}

.content-wrapper {
  padding: 24px;
  min-width: 1400px;
  overflow-x: auto;
}

/* ========================================
   Cards
   ======================================== */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  background: var(--surface);
}

.card-body {
  padding: 24px;
}

/* ========================================
   Page Header
   ======================================== */
.page-header {
  margin-bottom: 24px;
}

.page-header h2 {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.page-header .breadcrumb {
  margin: 4px 0 0;
  padding: 0;
  background: none;
  font-size: 13px;
}

.page-header .breadcrumb-item a {
  color: var(--text-muted);
  text-decoration: none;
}

.page-header .breadcrumb-item.active {
  color: var(--text-secondary);
}

/* ========================================
   Buttons
   ======================================== */
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  border-radius: var(--radius-sm);
}

.btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn-primary:focus {
  box-shadow: var(--focus-ring);
}

/* ========================================
   Forms
   ======================================== */
.form-control,
.form-select {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border-color: var(--border);
  font-size: 14px;
  transition: var(--transition);
}

.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: var(--focus-ring);
}

/* ========================================
   Dashboard Cards
   ======================================== */
.dash-card {
  border-radius: var(--radius);
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  transition: var(--transition);
}

.dash-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.dash-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: white;
  margin-bottom: 16px;
}

.dash-card-title {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.dash-card-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.show {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }
}

/* ========================================
   Login Page (no sidebar)
   ======================================== */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 40px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}

.login-card h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
  text-align: center;
  margin-bottom: 32px;
}

/* ========================================
   Utilities
   ======================================== */
.text-primary { color: var(--primary) !important; }
.text-muted { color: var(--text-muted) !important; }

#userInfoDetail a {
  transition: all 100ms linear;
}

#userInfoDetail a.collapsed {
  transform: rotate(180deg);
  transition: all 100ms linear;
}

/* ========================================
   Side Detail Panel
   ======================================== */
.side-panel {
  position: fixed;
  top: var(--gnb-height);
  right: 0;
  bottom: 0;
  width: 520px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -4px 0 16px rgba(0, 0, 0, 0.08);
  z-index: 800;
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.side-panel.open {
  transform: translateX(0);
}

.main-content {
  transition: margin-right 0.3s ease;
}

.main-content.panel-open {
  margin-right: 520px;
}

.side-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: #fafbfc;
  flex-shrink: 0;
}

.side-panel-header h5 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}

.side-panel-close {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: var(--transition);
}

.side-panel-close:hover {
  background: #f0f0f0;
  color: var(--text-primary);
}

.side-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.side-panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: #fafbfc;
  flex-shrink: 0;
}

@media (max-width: 1199.98px) {
  .side-panel {
    width: 420px;
  }
  .main-content.panel-open {
    margin-right: 420px;
  }
}

@media (max-width: 991.98px) {
  .side-panel {
    width: 100%;
    max-width: 480px;
  }
  .main-content.panel-open {
    margin-right: 0;
  }
}
