/* ================================================
   WIZTION 대시보드 CSS
   ================================================ */

/* CSS Variables */
:root {
  --primary: #4A7C59;
  --primary-dark: #3D6B4A;
  --primary-light: #E8F5E9;
  --accent: #F59E0B;
  --success: #10B981;
  --warning: #F59E0B;
  --error: #EF4444;

  --neutral-50: #F9FAFB;
  --neutral-100: #F3F4F6;
  --neutral-200: #E5E7EB;
  --neutral-300: #D1D5DB;
  --neutral-400: #9CA3AF;
  --neutral-500: #6B7280;
  --neutral-600: #4B5563;
  --neutral-700: #374151;
  --neutral-800: #1F2937;
  --neutral-900: #111827;

  --sidebar-width: 260px;
  --header-height: 70px;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
}

/* Reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  background-color: var(--neutral-100);
  color: var(--neutral-800);
  line-height: 1.6;
}

/* Dashboard Container */
.dashboard-container {
  display: flex;
  min-height: 100vh;
}

/* ================================================
   Sidebar
   ================================================ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--neutral-900);
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
}

.sidebar-header {
  padding: 24px;
  border-bottom: 1px solid var(--neutral-700);
}

.logo {
  font-size: 24px;
  font-weight: 700;
  color: #6B9B7A;
}

.logo-sub {
  font-size: 12px;
  color: var(--neutral-400);
  margin-left: 8px;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--neutral-400);
  text-decoration: none;
  border-radius: var(--radius-md);
  margin-bottom: 4px;
  transition: all 0.2s ease;
}

.nav-item:hover {
  background: var(--neutral-800);
  color: white;
}

.nav-item.active {
  background: var(--primary);
  color: white;
}

.nav-icon {
  font-size: 18px;
}

.nav-text {
  font-size: 14px;
  font-weight: 500;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid var(--neutral-700);
}

/* ================================================
   Main Content
   ================================================ */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding: 24px;
}

/* Header */
.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--neutral-200);
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--neutral-900);
}

.page-subtitle {
  font-size: 14px;
  color: var(--neutral-500);
  margin-top: 4px;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.user-name {
  font-size: 14px;
  color: var(--neutral-600);
}

.btn-logout {
  padding: 8px 16px;
  background: var(--neutral-200);
  border: none;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--neutral-700);
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-logout:hover {
  background: var(--neutral-300);
}

/* ================================================
   Stats Grid
   ================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.stat-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.stat-icon.icon-page {
  background: #D1FAE5;
  color: #059669;
}

.stat-icon.icon-time {
  background: #FEF3C7;
  color: #D97706;
}

.stat-icon.icon-inbox {
  background: #DBEAFE;
  color: #2563EB;
}

.stat-label {
  font-size: 14px;
  color: var(--neutral-500);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  color: var(--neutral-900);
}

.stat-change {
  font-size: 12px;
  margin-top: 4px;
}

.stat-change.positive {
  color: var(--success);
}

.stat-change.negative {
  color: var(--error);
}

/* ================================================
   Recent Section
   ================================================ */
.recent-section {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--neutral-800);
}

.section-link {
  font-size: 14px;
  color: var(--primary);
  text-decoration: none;
}

.section-link:hover {
  text-decoration: underline;
}

/* Data Table */
.table-container {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--neutral-100);
}

.data-table th {
  font-size: 13px;
  font-weight: 600;
  color: var(--neutral-500);
  background: var(--neutral-50);
}

.data-table td {
  font-size: 14px;
  color: var(--neutral-700);
}

.data-table tbody tr:hover {
  background: var(--neutral-50);
}

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.status-badge.pending {
  background: #FEF3C7;
  color: #D97706;
}

.status-badge.progress {
  background: #DBEAFE;
  color: #2563EB;
}

.status-badge.complete {
  background: #D1FAE5;
  color: #059669;
}

/* ================================================
   Mobile Menu Button
   ================================================ */
.mobile-menu-btn {
  display: none;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--neutral-700);
  cursor: pointer;
  border-radius: var(--radius-md);
  margin-right: 12px;
}

.mobile-menu-btn:hover {
  background: var(--neutral-100);
}

/* ================================================
   Responsive
   ================================================ */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .dashboard-container {
    overflow-x: hidden;
  }

  .main-content {
    max-width: 100vw;
    overflow-x: hidden;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .header-left {
    display: flex;
    align-items: center;
  }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .stat-card {
    padding: 16px;
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
    margin: 0 auto;
  }

  .stat-value {
    font-size: 22px;
  }

  .stat-label {
    font-size: 12px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }

  .page-title {
    font-size: 20px;
  }

  /* Recent Section Mobile */
  .recent-section {
    padding: 16px;
  }

  .recent-section .table-container {
    overflow: visible;
  }

  .recent-section .data-table {
    display: block;
  }

  .recent-section .data-table thead {
    display: none;
  }

  .recent-section .data-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .recent-section .data-table tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    gap: 4px 12px;
    background: var(--neutral-50);
    border-radius: var(--radius-md);
    padding: 12px;
    border: 1px solid var(--neutral-200);
  }

  .recent-section .data-table td {
    padding: 0;
    border: none;
  }

  .recent-section .data-table td:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
    font-size: 12px;
    color: var(--neutral-500);
  }

  .recent-section .data-table td:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
    font-weight: 600;
    font-size: 14px;
    text-align: right;
  }

  .recent-section .data-table td:nth-child(3),
  .recent-section .data-table td:nth-child(4) {
    display: none;
  }

  .recent-section .data-table td:nth-child(5) {
    grid-column: 1;
    grid-row: 2;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
  }

  .recent-section .data-table td:nth-child(6) {
    grid-column: 2;
    grid-row: 2;
    text-align: right;
  }

  .recent-section .status-badge {
    font-size: 11px;
    padding: 3px 8px;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .stat-card {
    padding: 12px;
  }

  .stat-icon {
    width: 32px;
    height: 32px;
  }

  .stat-icon svg {
    width: 16px;
    height: 16px;
  }

  .stat-value {
    font-size: 18px;
  }

  .stat-label {
    font-size: 11px;
  }

  .stat-change {
    font-size: 10px;
  }
}

/* ================================================
   Mobile Sidebar Overlay
   ================================================ */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
}

@media (max-width: 768px) {
  .sidebar-overlay.open {
    display: block;
  }
}

/* ================================================
   Mobile Bottom Navigation
   ================================================ */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  border-top: 1px solid var(--neutral-200);
  z-index: 100;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
  justify-content: space-around;
  align-items: center;
}

.bottom-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  color: var(--neutral-400);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  transition: all 0.2s ease;
  min-width: 56px;
  border-radius: var(--radius-md);
}

.bottom-nav-item svg {
  transition: all 0.2s ease;
}

.bottom-nav-item:hover {
  color: var(--neutral-600);
}

.bottom-nav-item.active {
  color: var(--primary);
}

.bottom-nav-item.active svg {
  stroke-width: 2.5;
}

.bottom-nav-item span {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .mobile-bottom-nav {
    display: flex;
  }

  .main-content {
    padding-bottom: 80px;
  }

  .modal-overlay {
    z-index: 200;
  }
}

@media (max-width: 480px) {
  .bottom-nav-item {
    padding: 6px 8px;
    min-width: 48px;
    font-size: 10px;
  }

  .bottom-nav-item svg {
    width: 20px;
    height: 20px;
  }
}

/* ================================================
   Billing Section (요금 안내)
   ================================================ */
.billing-section {
  margin-bottom: 24px;
}

.billing-section .section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--neutral-800);
  margin-bottom: 16px;
}

.billing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.billing-card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 2px solid transparent;
}

.billing-card.billing-free {
  border-color: var(--success);
  background: linear-gradient(135deg, #F0FDF4 0%, #DCFCE7 100%);
}

.billing-card.billing-paid {
  border-color: var(--neutral-200);
  background: white;
}

.billing-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.billing-header h4 {
  font-size: 15px;
  font-weight: 600;
  color: var(--neutral-800);
}

.billing-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.billing-badge.free {
  background: var(--success);
  color: white;
}

.billing-badge.paid {
  background: var(--neutral-200);
  color: var(--neutral-600);
}

.billing-list {
  list-style: none;
}

.billing-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--neutral-100);
  font-size: 14px;
}

.billing-list li:last-child {
  border-bottom: none;
}

.billing-list li strong {
  color: var(--neutral-700);
}

.billing-list li span {
  color: var(--neutral-500);
}

.billing-free .billing-list li span {
  color: #059669;
  font-weight: 500;
}

.billing-note {
  margin-top: 16px;
  padding: 12px 16px;
  background: var(--primary-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--primary);
  text-align: center;
}

/* Traffic Simulation */
.traffic-simulation {
  margin-top: 20px;
  background: white;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow-sm);
}

.traffic-simulation h4 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--neutral-700);
  margin-bottom: 16px;
}

.traffic-simulation h4 svg {
  color: var(--primary);
}

.simulation-content > p {
  font-size: 13px;
  color: var(--neutral-600);
  margin-bottom: 12px;
}

.simulation-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.simulation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--neutral-50);
  border-radius: var(--radius-md);
  font-size: 13px;
}

.sim-visitors {
  font-weight: 600;
  color: var(--neutral-800);
  min-width: 90px;
}

.sim-calc {
  flex: 1;
  color: var(--neutral-500);
}

.sim-status {
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.sim-status.safe {
  background: #D1FAE5;
  color: #059669;
}

.sim-status.warning {
  background: #FEF3C7;
  color: #D97706;
}

.sim-status.danger {
  background: #FEE2E2;
  color: #DC2626;
}

.simulation-note {
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--neutral-100);
  border-radius: var(--radius-md);
  font-size: 12px;
  color: var(--neutral-600);
}

/* ================================================
   Stack Table Styles
   ================================================ */
.stack-table .service-name {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stack-table .service-icon {
  font-size: 20px;
}

.stack-table .service-name strong {
  display: block;
  font-size: 14px;
  color: var(--neutral-800);
  white-space: nowrap;
}

.stack-table .service-name small {
  font-size: 12px;
  color: var(--neutral-500);
  white-space: nowrap;
}

.stack-table code {
  background: var(--neutral-100);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 13px;
  color: var(--neutral-700);
}

.stack-table a {
  color: var(--primary);
  text-decoration: none;
  font-size: 13px;
}

.stack-table a:hover {
  text-decoration: underline;
}

/* ================================================
   Settings Page Mobile
   ================================================ */
@media (max-width: 768px) {
  /* 요금 안내 카드 */
  .billing-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .billing-card {
    padding: 16px;
  }

  .billing-list li {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  /* 트래픽 시뮬레이션 */
  .traffic-simulation {
    padding: 16px;
  }

  .simulation-item {
    flex-wrap: wrap;
    gap: 8px;
  }

  .sim-visitors {
    width: 100%;
  }

  .sim-calc {
    font-size: 12px;
    flex: 1;
  }

  /* 스택 테이블 모바일 - 카드 형태로 변환 */
  .settings-section .section-header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .stack-table {
    display: block;
  }

  .stack-table thead {
    display: none;
  }

  .stack-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .stack-table tr {
    display: block;
    background: var(--neutral-50);
    border: 1px solid var(--neutral-200);
    border-radius: var(--radius-lg);
    padding: 16px;
  }

  .stack-table td {
    display: block;
    padding: 4px 0;
    border: none;
  }

  /* 서비스명 - 상단 */
  .stack-table td:first-child {
    margin-bottom: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--neutral-200);
  }

  .stack-table .service-name {
    gap: 10px;
  }

  .stack-table .service-icon {
    font-size: 18px;
  }

  .stack-table .service-name strong {
    font-size: 15px;
    white-space: nowrap;
  }

  .stack-table .service-name small {
    white-space: nowrap;
  }

  /* ID/계정 */
  .stack-table td:nth-child(2) {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .stack-table td:nth-child(2)::before {
    content: "ID: ";
    color: var(--neutral-500);
    font-size: 11px;
  }

  .stack-table code {
    font-size: 12px;
    padding: 2px 6px;
  }

  /* URL */
  .stack-table td:nth-child(3) {
    font-size: 12px;
  }

  .stack-table td:nth-child(3)::before {
    content: "URL: ";
    color: var(--neutral-500);
    font-size: 11px;
  }

  /* 특이사항 */
  .stack-table td:nth-child(4) {
    margin-top: 8px;
  }
}
