/* =============================================
   CYL GLOBAL 관리자 패널 CSS
   price.cyl.co.kr/admin/
   2팀(프론트엔드)
   ============================================= */

* { margin:0; padding:0; box-sizing:border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Malgun Gothic', 'Segoe UI', sans-serif; background:#f5f5f7; color:#333; }

/* === Login === */
.login-screen { display:flex; align-items:center; justify-content:center; min-height:100vh; background:linear-gradient(135deg,#1a1a2e 0%,#16213e 50%,#0f3460 100%); }
.login-box { background:#fff; border-radius:16px; padding:40px; width:380px; max-width:90%; box-shadow:0 20px 60px rgba(0,0,0,0.3); }
.login-logo { font-family:'Playfair Display',serif; font-size:36px; color:#1a1a2e; text-align:center; letter-spacing:6px; }
.login-sub { font-size:11px; color:#c5a44e; text-align:center; letter-spacing:4px; margin-bottom:28px; }
.login-err { color:#e53935; font-size:12px; margin-bottom:8px; text-align:center; min-height:18px; }

/* === Form === */
.fg { margin-bottom:14px; }
.fg label { display:block; font-size:12px; color:#666; margin-bottom:4px; font-weight:500; }
.fg input, .fg select, .fg textarea {
  width:100%; padding:10px 12px; border:1px solid #e0e0e0; border-radius:8px;
  font-size:14px; transition:border-color 0.2s; background:#fff; font-family:inherit;
}
.fg input:focus, .fg select:focus, .fg textarea:focus { border-color:#c5a44e; outline:none; box-shadow:0 0 0 3px rgba(197,164,78,0.1); }
.fg textarea { min-height:60px; resize:vertical; }
.fg-row { display:flex; gap:12px; }
.fg-row .fg { flex:1; }

/* === Buttons === */
.btn { padding:10px 18px; border-radius:8px; border:none; font-size:13px; font-weight:500; cursor:pointer; transition:all 0.2s; font-family:inherit; display:inline-flex; align-items:center; gap:6px; }
.btn-pr { background:linear-gradient(135deg,#1a1a2e,#16213e); color:#c5a44e; }
.btn-pr:hover { opacity:0.9; transform:translateY(-1px); }
.btn-sc { background:#f0ece3; color:#1a1a2e; }
.btn-sc:hover { background:#e8dcc8; }
.btn-dn { background:#e53935; color:#fff; }
.btn-dn:hover { background:#c62828; }
.btn-gn { background:#43a047; color:#fff; }
.btn-gn:hover { background:#2e7d32; }
.btn-gold { background:linear-gradient(135deg,#c5a44e,#d4b85a); color:#fff; }
.btn-gold:hover { opacity:0.9; }
.btn-full { width:100%; justify-content:center; }
.btn-sm { padding:6px 12px; font-size:12px; }
.btn:disabled { opacity:0.5; cursor:not-allowed; }

/* === Admin Layout === */
.admin-app { display:flex; min-height:100vh; }

/* Sidebar */
.sidebar {
  width:240px; background:#1a1a2e; color:#fff;
  display:flex; flex-direction:column;
  position:fixed; top:0; bottom:0; left:0; z-index:100;
  transition:transform 0.3s;
}
.sb-hdr { padding:24px 20px; text-align:center; border-bottom:1px solid rgba(255,255,255,0.1); }
.sb-logo { font-family:'Playfair Display',serif; font-size:24px; color:#c5a44e; letter-spacing:4px; }
.sb-badge { display:inline-block; font-size:9px; letter-spacing:2px; background:#c5a44e; color:#1a1a2e; padding:2px 8px; border-radius:3px; margin-left:8px; vertical-align:middle; }
.sb-nav { flex:1; padding:12px 0; overflow-y:auto; }
.sb-item {
  display:flex; align-items:center; gap:10px;
  padding:12px 20px; font-size:14px; color:rgba(255,255,255,0.6);
  cursor:pointer; transition:all 0.2s; text-decoration:none;
  border-left:3px solid transparent;
}
.sb-item:hover { color:#fff; background:rgba(255,255,255,0.05); }
.sb-item.ac { color:#c5a44e; background:rgba(197,164,78,0.1); border-left-color:#c5a44e; }
.sb-ic { font-size:16px; width:24px; text-align:center; flex-shrink:0; }
.sb-ft { padding:16px 20px; border-top:1px solid rgba(255,255,255,0.1); }
.sb-user { font-size:12px; color:rgba(255,255,255,0.5); margin-bottom:8px; text-align:center; }

/* Mobile header */
.mobile-hdr {
  display:none; position:fixed; top:0; left:0; right:0; z-index:90;
  background:#1a1a2e; color:#c5a44e; padding:12px 16px;
  align-items:center; gap:12px;
}
.menu-toggle { background:none; border:none; color:#c5a44e; font-size:24px; cursor:pointer; }
.mobile-title { font-family:'Playfair Display',serif; font-size:16px; letter-spacing:3px; }

/* Main Content */
.admin-main { margin-left:240px; flex:1; padding:24px; min-height:100vh; }
.admin-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; flex-wrap:wrap; gap:12px; }
.admin-header h2 { font-size:18px; color:#1a1a2e; font-weight:600; }
.header-actions { display:flex; gap:8px; flex-wrap:wrap; }

/* === Stat Cards === */
.stat-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:16px; margin-bottom:24px; }
.stat-card {
  background:#fff; border-radius:16px; padding:20px;
  box-shadow:0 1px 3px rgba(0,0,0,0.08); position:relative; overflow:hidden;
}
.stat-card::after { content:''; position:absolute; top:0; left:0; right:0; height:3px; }
.stat-card.blue::after { background:linear-gradient(90deg,#4fc3f7,#29b6f6); }
.stat-card.gold::after { background:linear-gradient(90deg,#c5a44e,#d4b85a); }
.stat-card.green::after { background:linear-gradient(90deg,#66bb6a,#43a047); }
.stat-card.purple::after { background:linear-gradient(90deg,#ab47bc,#8e24aa); }
.stat-ic { font-size:28px; margin-bottom:8px; }
.stat-val { font-size:28px; font-weight:700; color:#1a1a2e; font-variant-numeric:tabular-nums; }
.stat-lbl { font-size:12px; color:#999; margin-top:4px; }
.stat-chg { font-size:11px; margin-top:4px; }
.stat-chg.up { color:#43a047; }
.stat-chg.dn { color:#e53935; }

/* === Toolbar === */
.toolbar { display:flex; gap:12px; margin-bottom:16px; flex-wrap:wrap; align-items:center; }
.toolbar select, .toolbar input {
  padding:10px 14px; border:1px solid #e0e0e0; border-radius:8px;
  font-size:14px; font-family:inherit; background:#fff;
}
.toolbar select:focus, .toolbar input:focus { border-color:#c5a44e; outline:none; }
.toolbar .spacer { flex:1; }
.toolbar .search-box { flex:1; min-width:200px; max-width:360px; }

/* === Data Table === */
.adm-table {
  width:100%; border-collapse:collapse; background:#fff;
  border-radius:12px; overflow:hidden;
  box-shadow:0 1px 3px rgba(0,0,0,0.08);
}
.adm-table th {
  background:#f8f8fa; padding:12px 16px; font-size:11px; color:#888;
  text-align:left; font-weight:600; letter-spacing:0.5px; text-transform:uppercase;
  border-bottom:2px solid #eee; white-space:nowrap; cursor:pointer; user-select:none;
  position:relative;
}
.adm-table th:hover { background:#f0ece3; }
.adm-table th .sort-arrow { font-size:10px; margin-left:4px; opacity:0.4; }
.adm-table th.sorted .sort-arrow { opacity:1; color:#c5a44e; }
.adm-table td {
  padding:12px 16px; font-size:13px;
  border-bottom:1px solid #f5f5f5; vertical-align:middle;
}
.adm-table tr:last-child td { border-bottom:none; }
.adm-table tr:hover td { background:#faf8f4; }
.adm-table .actions { white-space:nowrap; }
.adm-table .actions .btn { margin-left:4px; }
.adm-table .num { text-align:right; font-variant-numeric:tabular-nums; }
.adm-table .price { font-weight:600; color:#1a1a2e; }
.adm-table .muted { color:#999; font-size:12px; }

/* === Badge === */
.badge { display:inline-block; font-size:11px; padding:2px 8px; border-radius:10px; font-weight:500; }
.badge-active { background:#e8f5e9; color:#2e7d32; }
.badge-inactive { background:#fbe9e7; color:#c62828; }
.badge-ov { background:#e3f2fd; color:#1565c0; }
.badge-dm { background:#fff3e0; color:#e65100; }

/* === Pagination === */
.paging { display:flex; align-items:center; justify-content:center; gap:4px; margin-top:20px; flex-wrap:wrap; }
.paging button {
  padding:6px 12px; border:1px solid #e0e0e0; background:#fff;
  border-radius:6px; font-size:13px; cursor:pointer; font-family:inherit;
  transition:all 0.2s; min-width:36px;
}
.paging button:hover { border-color:#c5a44e; background:#faf8f4; }
.paging button.ac { background:#1a1a2e; color:#c5a44e; border-color:#1a1a2e; }
.paging button:disabled { opacity:0.3; cursor:not-allowed; }
.paging .pg-info { font-size:12px; color:#999; margin:0 8px; }
.paging select { padding:4px 8px; border:1px solid #e0e0e0; border-radius:6px; font-size:12px; }

/* === Empty State === */
.empty-state { text-align:center; padding:60px 20px; color:#999; }
.empty-state .icon { font-size:48px; margin-bottom:12px; }
.empty-state p { font-size:14px; }

/* === Card Panel === */
.panel { background:#fff; border-radius:12px; padding:20px; box-shadow:0 1px 3px rgba(0,0,0,0.08); margin-bottom:16px; }
.panel-hd { display:flex; justify-content:space-between; align-items:center; margin-bottom:14px; }
.panel-hd h3 { font-size:15px; color:#1a1a2e; font-weight:600; }

/* === Data Management === */
.data-cards { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:16px; }
.data-card {
  background:#fff; border:1px solid #eee; border-radius:16px; padding:24px;
  text-align:center; cursor:pointer; transition:all 0.2s;
}
.data-card:hover { border-color:#c5a44e; background:#faf8f4; transform:translateY(-2px); box-shadow:0 4px 12px rgba(0,0,0,0.08); }
.data-card .dc-ic { font-size:36px; margin-bottom:12px; }
.data-card .dc-nm { font-size:15px; font-weight:600; color:#1a1a2e; margin-bottom:6px; }
.data-card .dc-desc { font-size:12px; color:#999; line-height:1.5; }

/* === Quick Chart === */
.chart-row { display:grid; grid-template-columns:1fr 1fr; gap:16px; margin-bottom:24px; }
.chart-card { background:#fff; border-radius:12px; padding:20px; box-shadow:0 1px 3px rgba(0,0,0,0.08); }
.chart-card h4 { font-size:13px; color:#666; margin-bottom:14px; }
.bar-chart { display:flex; flex-direction:column; gap:8px; }
.bar-row { display:flex; align-items:center; gap:10px; }
.bar-label { font-size:12px; color:#666; width:100px; flex-shrink:0; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.bar-track { flex:1; height:20px; background:#f5f5f7; border-radius:4px; overflow:hidden; }
.bar-fill { height:100%; border-radius:4px; transition:width 0.6s ease; }
.bar-fill.gold { background:linear-gradient(90deg,#c5a44e,#d4b85a); }
.bar-fill.blue { background:linear-gradient(90deg,#4fc3f7,#29b6f6); }
.bar-val { font-size:11px; color:#999; width:60px; text-align:right; flex-shrink:0; }

/* === Modal === */
.modal { position:fixed; top:0; left:0; right:0; bottom:0; z-index:9999; display:flex; align-items:center; justify-content:center; }
.modal-bg { position:absolute; top:0; left:0; right:0; bottom:0; background:rgba(0,0,0,0.5); }
.modal-box {
  position:relative; background:#fff; border-radius:16px;
  max-width:560px; width:90%; max-height:85vh; overflow-y:auto;
  box-shadow:0 20px 60px rgba(0,0,0,0.2); animation:modalIn 0.2s ease;
}
.modal-box.wide { max-width:720px; }
.modal-hd { display:flex; justify-content:space-between; align-items:center; padding:16px 24px; border-bottom:1px solid #eee; position:sticky; top:0; background:#fff; z-index:1; border-radius:16px 16px 0 0; }
.modal-hd h3 { font-size:16px; color:#1a1a2e; }
.modal-x { cursor:pointer; font-size:20px; color:#999; padding:4px; }
.modal-x:hover { color:#333; }
.modal-bd { padding:24px; }
.modal-ft { padding:16px 24px; border-top:1px solid #eee; display:flex; justify-content:flex-end; gap:8px; position:sticky; bottom:0; background:#fff; border-radius:0 0 16px 16px; }
@keyframes modalIn { from { opacity:0; transform:scale(0.95); } to { opacity:1; transform:scale(1); } }

/* === Toast === */
.admin-toast { position:fixed; bottom:20px; right:20px; z-index:99999; }
.toast-item { padding:12px 20px; border-radius:8px; font-size:13px; color:#fff; margin-top:8px; animation:fadeInUp 0.3s; box-shadow:0 4px 12px rgba(0,0,0,0.15); max-width:360px; }
.toast-success { background:#43a047; }
.toast-error { background:#e53935; }
.toast-info { background:#1565c0; }
@keyframes fadeInUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }

/* === Loading Overlay === */
.loading-overlay {
  position:fixed; top:0; left:0; right:0; bottom:0;
  background:rgba(255,255,255,0.8); z-index:9998;
  display:flex; align-items:center; justify-content:center;
}
.spinner { width:40px; height:40px; border:3px solid #eee; border-top-color:#c5a44e; border-radius:50%; animation:spin 0.8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

/* === Price List Editor === */
.pl-editor { margin-top:16px; }
.pl-table { border-collapse:collapse; }
.pl-table th {
  background:#1a1a2e; color:#c5a44e; font-size:10px; padding:10px 8px;
  text-align:center; white-space:nowrap; letter-spacing:0.3px; border:1px solid #2a2a4e;
}
.pl-table th[colspan] { border-bottom:2px solid #c5a44e; }
.pl-table td { padding:4px 6px; border:1px solid #e8e8e8; }
.pl-table tr:hover td { background:#fffdf5; }
.pl-cat-cell {
  background:#fafafa !important; vertical-align:top; padding:8px !important;
  border-right:2px solid #e0dcc8 !important; min-width:140px; max-width:180px;
}
.pl-input {
  width:100%; padding:6px 8px; border:1px solid transparent; border-radius:4px;
  font-size:13px; font-family:inherit; background:transparent; transition:all 0.15s;
}
.pl-input:hover { border-color:#ddd; background:#fff; }
.pl-input:focus { border-color:#c5a44e; background:#fff; outline:none; box-shadow:0 0 0 2px rgba(197,164,78,0.12); }
.pl-price { text-align:right; font-variant-numeric:tabular-nums; width:90px; }
.pl-price::-webkit-inner-spin-button { opacity:0; }
.pl-price:hover::-webkit-inner-spin-button { opacity:1; }
.pl-cat-name { font-weight:600; margin-bottom:4px; }
.pl-cat-name-en { font-size:11px; color:#999; }

/* PL Editor buttons */
.pl-editor .btn-sm { padding:4px 8px; font-size:11px; border-radius:4px; }
.pl-editor .btn-dn.btn-sm { font-size:10px; }

/* PL Toolbar area */
.pl-editor-toolbar { display:flex; gap:8px; justify-content:flex-end; margin-top:12px; flex-wrap:wrap; }

/* === Responsive === */
@media (max-width:768px) {
  .sidebar { transform:translateX(-100%); width:260px; }
  .sidebar.open { transform:translateX(0); }
  .mobile-hdr { display:flex; }
  .admin-main { margin-left:0; padding:16px; padding-top:60px; }
  .stat-grid { grid-template-columns:repeat(2,1fr); }
  .chart-row { grid-template-columns:1fr; }
  .toolbar { flex-direction:column; }
  .toolbar .search-box { max-width:100%; }
  .adm-table { font-size:12px; }
  .adm-table th, .adm-table td { padding:8px 10px; }
  .data-cards { grid-template-columns:1fr; }
  .header-actions { width:100%; }
  .header-actions .btn { flex:1; justify-content:center; }
}

@media (max-width:480px) {
  .stat-grid { grid-template-columns:1fr; }
  .admin-header { flex-direction:column; align-items:flex-start; }
  .fg-row { flex-direction:column; gap:0; }
  .paging button { padding:6px 8px; font-size:12px; min-width:32px; }
}

/* === 견적이력 === */
.qt-search-bar { margin-bottom:16px; }
.qt-search-input {
  width:100%; max-width:400px; padding:10px 14px; border:1px solid #ddd; border-radius:8px;
  font-size:14px; background:#fff; transition:border-color 0.2s;
}
.qt-search-input:focus { outline:none; border-color:#c9a96e; box-shadow:0 0 0 3px rgba(201,169,110,0.15); }

/* 견적이력 테이블 */
.qt-table-wrap { overflow-x:auto; }
.qt-history-table { width:100%; border-collapse:collapse; background:#fff; border-radius:10px; overflow:hidden; box-shadow:0 1px 3px rgba(0,0,0,0.04); }
.qt-history-table thead th { background:#f9f9fb; padding:12px 14px; font-size:12px; font-weight:600; color:#888; text-transform:uppercase; letter-spacing:0.5px; border-bottom:2px solid #eee; text-align:left; white-space:nowrap; }
.qt-history-table thead th.num { text-align:right; }
.qt-history-table tbody tr.qt-row { cursor:pointer; transition:background 0.15s; border-bottom:1px solid #f0f0f0; }
.qt-history-table tbody tr.qt-row:hover { background:#faf8f5; }
.qt-history-table tbody tr.qt-row:last-child { border-bottom:none; }
.qt-history-table td { padding:12px 14px; font-size:13px; color:#333; vertical-align:middle; }
.qt-col-date { white-space:nowrap; color:#888; font-size:12px; font-variant-numeric:tabular-nums; }
.qt-col-mgr { color:#555; }
.qt-col-client strong { color:#222; font-weight:600; }
.qt-col-amount { text-align:right; font-weight:700; color:#c9a96e; font-size:14px; white-space:nowrap; font-variant-numeric:tabular-nums; }
.qt-col-url { white-space:nowrap; }
.qt-link { display:inline-flex; align-items:center; gap:4px; color:#4a7fb5; text-decoration:none; font-size:12px; font-weight:500; padding:4px 10px; background:#eef4fb; border-radius:6px; transition:all 0.15s; }
.qt-link:hover { background:#ddeaf7; color:#2e6699; text-decoration:none; }
.qt-col-action { text-align:center; }

/* 견적 상세 */
.qt-detail-info { background:#f9f9fb; border-radius:8px; padding:14px 16px; margin-bottom:16px; }
.qt-info-row { display:flex; justify-content:space-between; padding:5px 0; border-bottom:1px solid #eee; font-size:13px; }
.qt-info-row:last-child { border-bottom:none; }
.qt-info-label { color:#888; min-width:70px; }
.qt-info-val { font-weight:500; color:#333; text-align:right; }

.qt-detail-amounts { background:#1a1a2e; border-radius:8px; padding:14px 16px; color:#fff; }
.qt-amt-row { display:flex; justify-content:space-between; padding:5px 0; font-size:14px; }
.qt-amt-disc { color:#ff6b6b; }
.qt-amt-final { border-top:1px solid rgba(255,255,255,0.2); padding-top:10px; margin-top:6px; font-size:18px; font-weight:700; color:#c9a96e; }

.qt-detail-svc { margin-top:16px; padding:14px 16px; background:#faf8f5; border-radius:8px; border:1px solid #f0e8d8; }
.qt-detail-svc h4 { font-size:13px; color:#b8860b; margin-bottom:8px; }
.qt-svc-item { font-size:13px; color:#555; padding:3px 0; }

@media (max-width:600px) {
  .qt-history-table thead th { padding:8px 10px; font-size:11px; }
  .qt-history-table td { padding:8px 10px; font-size:12px; }
  .qt-col-amount { font-size:12px; }
  .qt-col-action { display:none; }
}
