/* =========================================================
   POLL Survey System - Admin Dashboard Stylesheet
   ========================================================= */

:root {
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-light: rgba(99, 102, 241, 0.12);
  
  --secondary: #8b5cf6;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #0ea5e9;

  --bg-dark: #090d16;
  --sidebar-bg: #0e1424;
  --card-bg: rgba(18, 24, 40, 0.75);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-hover: rgba(255, 255, 255, 0.03);

  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;

  --input-bg: #141c2e;
  --input-border: rgba(255, 255, 255, 0.12);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;

  --font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background: radial-gradient(circle at 10% 20%, #111827 0%, var(--bg-dark) 90%);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* App Container */
.admin-app {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px 60px;
}

/* Header */
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--card-border);
  margin-bottom: 28px;
}
.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}
.brand-title {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.brand-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  font-family: inherit;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover {
  filter: brightness(1.1);
  transform: translateY(-1px);
}
.btn-dark {
  background: var(--input-bg);
  border-color: var(--input-border);
  color: var(--text-main);
}
.btn-dark:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
}
.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}
.btn-danger:hover {
  background: var(--danger);
  color: #ffffff;
}

/* KPI Summary Cards Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}
.kpi-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: var(--primary);
}
.kpi-card.nps-card::before { background: #10b981; }
.kpi-card.score-card::before { background: #8b5cf6; }
.kpi-card.time-card::before { background: #f59e0b; }

.kpi-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.kpi-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.kpi-icon {
  font-size: 1.25rem;
  opacity: 0.8;
}

.kpi-value-wrap {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
}
.kpi-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.03em;
}
.kpi-badge {
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
}
.kpi-badge.neutral {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.kpi-footer {
  font-size: 0.8rem;
  color: var(--text-subtle);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 8px;
  margin-top: 4px;
}

/* NPS Distribution Bar in Card */
.nps-bar-wrap {
  display: flex;
  height: 8px;
  width: 100%;
  border-radius: 99px;
  overflow: hidden;
  margin-top: 8px;
  background: rgba(255, 255, 255, 0.05);
}
.nps-seg-promoter { background: #10b981; }
.nps-seg-passive { background: #f59e0b; }
.nps-seg-detractor { background: #ef4444; }

/* Charts Section */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 22px;
  margin-bottom: 32px;
}
@media (max-width: 980px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }
}
.chart-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
}
.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.chart-title {
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-body {
  position: relative;
  flex-grow: 1;
  min-height: 260px;
}

/* Recent Feedbacks Box */
.feedbacks-stream-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  margin-bottom: 32px;
}
.stream-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.stream-title {
  font-size: 1.05rem;
  font-weight: 700;
}
.stream-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 14px;
}
.feedback-bubble {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}
.feedback-text {
  font-size: 0.9rem;
  color: var(--text-main);
  line-height: 1.5;
}
.feedback-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}
.score-badge {
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}
.score-badge.promoter { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.score-badge.passive { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.score-badge.detractor { background: rgba(239, 68, 68, 0.2); color: #f87171; }

/* Data Table Section */
.table-section {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
}
.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.search-input {
  padding: 9px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.875rem;
  min-width: 240px;
  outline: none;
}
.search-input:focus {
  border-color: var(--primary);
}

.select-filter {
  padding: 9px 14px;
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 0.875rem;
  outline: none;
  cursor: pointer;
}

.bulk-actions-wrap {
  display: none;
  align-items: center;
  gap: 10px;
}
.bulk-actions-wrap.active {
  display: flex;
}

/* Responses Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  text-align: left;
}
.data-table th {
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}
.data-table td {
  padding: 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  vertical-align: middle;
}
.data-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.star-btn {
  background: none;
  border: none;
  font-size: 1.1rem;
  color: var(--text-subtle);
  cursor: pointer;
  transition: all 0.2s ease;
}
.star-btn.fav {
  color: #fbbf24;
}
.star-btn:hover {
  transform: scale(1.2);
}

.action-btns {
  display: flex;
  gap: 6px;
}
.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-icon:hover {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--primary);
}
.btn-icon.delete:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: var(--danger);
  color: #f87171;
}

/* Pagination */
.pagination-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.pagination-nav {
  display: flex;
  gap: 6px;
}
.page-btn {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  cursor: pointer;
}
.page-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}
.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-overlay.open {
  display: flex;
}
.modal-content {
  background: #111827;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.6);
  position: relative;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
}
.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
}
.close-modal-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Detail Q&A Row */
.detail-item {
  margin-bottom: 18px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.05);
}
.detail-q {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 6px;
}
.detail-a {
  font-size: 0.95rem;
  color: var(--text-main);
  line-height: 1.5;
}

/* Login Modal */
.login-box {
  max-width: 400px;
  text-align: center;
}
.login-box .lock-icon {
  font-size: 3rem;
  margin-bottom: 12px;
}
.login-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--input-bg);
  border: 1.5px solid var(--input-border);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  font-size: 1rem;
  margin: 18px 0;
  outline: none;
  text-align: center;
}
.login-input:focus {
  border-color: var(--primary);
}
