/* PMO 프로젝트 관리 시스템 - 전체 스타일 */

:root {
  --primary: #4F46E5;
  --primary-dark: #3730A3;
  --primary-light: #EEF2FF;
  --secondary: #0EA5E9;
  --success: #10B981;
  --warning: #F59E0B;
  --danger: #EF4444;
  --gray-50: #F9FAFB;
  --gray-100: #F3F4F6;
  --gray-200: #E5E7EB;
  --gray-300: #D1D5DB;
  --gray-600: #4B5563;
  --gray-700: #374151;
  --gray-800: #1F2937;
  --gray-900: #111827;
  --sidebar-width: 240px;
}

* { box-sizing: border-box; }
body { font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }

/* ===== SIDEBAR ===== */
#sidebar {
  position: fixed; top: 0; left: 0;
  width: var(--sidebar-width); height: 100vh;
  background: linear-gradient(180deg, #1e1b4b 0%, #312e81 100%);
  z-index: 100; overflow-y: auto; transition: transform 0.3s ease;
  display: flex; flex-direction: column;
}
#sidebar .logo-area {
  padding: 20px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  position: relative;
}
#sidebar .logo-area h1 {
  font-size: 13px; font-weight: 700; color: #c7d2fe;
  letter-spacing: 0.5px; text-transform: uppercase;
}
#sidebar .logo-area .logo-title {
  font-size: 18px; font-weight: 800; color: white; margin-top: 4px;
}
#sidebar .project-badge {
  display: inline-block; background: rgba(99,102,241,0.4);
  border: 1px solid rgba(165,180,252,0.3);
  border-radius: 6px; padding: 3px 8px;
  font-size: 11px; color: #a5b4fc; margin-top: 8px;
  cursor: pointer;
}
#sidebar .nav-section-title {
  font-size: 10px; font-weight: 600; color: #818cf8;
  text-transform: uppercase; letter-spacing: 0.8px;
  padding: 16px 16px 6px;
}
#sidebar .nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; cursor: pointer;
  color: #c7d2fe; font-size: 13.5px; font-weight: 500;
  border-radius: 0; transition: all 0.15s;
  text-decoration: none;
}
#sidebar .nav-item:hover { background: rgba(255,255,255,0.08); color: white; }
#sidebar .nav-item.active {
  background: rgba(99,102,241,0.35); color: white;
  border-right: 3px solid #818cf8;
}
#sidebar .nav-item i { width: 18px; text-align: center; font-size: 13px; }
#sidebar .nav-sub-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px 7px 44px; cursor: pointer;
  color: #a5b4fc; font-size: 12.5px;
  transition: all 0.15s;
}
#sidebar .nav-sub-item:hover { color: white; background: rgba(255,255,255,0.05); }
#sidebar .nav-sub-item.active { color: #e0e7ff; font-weight: 600; }
#sidebar .sidebar-footer {
  margin-top: auto; padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 11px; color: #818cf8;
}

/* ===== MAIN CONTENT ===== */
#main-content {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  background: #f0f2f8;
}
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: white; border-bottom: 1px solid var(--gray-200);
  padding: 0 24px; height: 60px;
  display: flex; align-items: center; justify-content: space-between;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
#topbar .breadcrumb { font-size: 13px; color: var(--gray-600); }
#topbar .breadcrumb span { color: var(--primary); font-weight: 600; }
#topbar .topbar-right { display: flex; align-items: center; gap: 12px; }
#topbar .topbar-right .avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, #4F46E5, #0EA5E9);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 13px; font-weight: 700; cursor: pointer;
}

#page-content { padding: 24px; }

/* ===== PAGE HEADER ===== */
.page-header { margin-bottom: 24px; }
.page-header h2 {
  font-size: 22px; font-weight: 800; color: var(--gray-800);
  display: flex; align-items: center; gap: 10px;
}
.page-header p { font-size: 13px; color: var(--gray-600); margin-top: 4px; }

/* ===== CARDS ===== */
.card {
  background: white; border-radius: 12px;
  border: 1px solid var(--gray-200); overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}
.card-header {
  padding: 14px 18px; border-bottom: 1px solid var(--gray-100);
  display: flex; align-items: center; justify-content: space-between;
}
.card-header h3 { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.card-body { padding: 18px; }

/* ===== STAT CARDS ===== */
.stat-card {
  background: white; border-radius: 12px;
  border: 1px solid var(--gray-200);
  padding: 18px 20px;
  display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
  transition: transform 0.15s, box-shadow 0.15s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.08); }
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.stat-card .stat-value { font-size: 24px; font-weight: 800; color: var(--gray-800); line-height: 1; }
.stat-card .stat-label { font-size: 12px; color: var(--gray-600); margin-top: 3px; }
.stat-card .stat-change {
  font-size: 11px; margin-top: 4px; display: flex; align-items: center; gap: 3px;
}
.stat-card .stat-change.up { color: var(--success); }
.stat-card .stat-change.down { color: var(--danger); }

/* ===== BADGES ===== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 600;
}
.badge-blue { background: #DBEAFE; color: #1D4ED8; }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-yellow { background: #FEF3C7; color: #92400E; }
.badge-red { background: #FEE2E2; color: #991B1B; }
.badge-purple { background: #EDE9FE; color: #5B21B6; }
.badge-gray { background: #F3F4F6; color: #374151; }
.badge-orange { background: #FED7AA; color: #9A3412; }
.badge-indigo { background: #E0E7FF; color: #3730A3; }

/* ===== TABLES ===== */
.table-wrap { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; }
table.data-table thead tr {
  background: #F8FAFF; border-bottom: 2px solid var(--gray-200);
}
table.data-table thead th {
  padding: 10px 12px; text-align: left;
  font-size: 11px; font-weight: 700; color: var(--gray-600);
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
}
table.data-table tbody tr {
  border-bottom: 1px solid var(--gray-100);
  transition: background 0.1s;
}
table.data-table tbody tr:hover { background: #F8FAFF; }
table.data-table tbody td {
  padding: 10px 12px; font-size: 13px; color: var(--gray-700);
}
table.data-table tbody tr:last-child { border-bottom: none; }

/* ===== FORM ELEMENTS ===== */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--gray-700); margin-bottom: 5px;
}
.form-control {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--gray-300); border-radius: 8px;
  font-size: 13px; color: var(--gray-800);
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
  background: white;
}
.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.form-control:disabled { background: var(--gray-100); color: var(--gray-600); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  border: none; transition: all 0.15s; text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: white; color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-50); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #059669; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-warning { background: var(--warning); color: white; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 6px; }
.btn-icon { padding: 7px; border-radius: 7px; }
.btn-outline-primary {
  background: transparent; color: var(--primary);
  border: 1px solid var(--primary);
}
.btn-outline-primary:hover { background: var(--primary-light); }

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px; animation: fadeIn 0.2s ease;
}
.modal {
  background: white; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  width: 100%; max-height: 90vh; overflow-y: auto;
  animation: slideUp 0.25s ease;
}
.modal-sm { max-width: 420px; }
.modal-md { max-width: 600px; }
.modal-lg { max-width: 800px; }
.modal-xl { max-width: 1000px; }
.modal-header {
  padding: 18px 20px; border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; background: white; z-index: 1;
}
.modal-header h3 { font-size: 16px; font-weight: 800; color: var(--gray-800); }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 14px 20px; border-top: 1px solid var(--gray-200);
  display: flex; justify-content: flex-end; gap: 8px;
  position: sticky; bottom: 0; background: white;
}

/* ===== TABS ===== */
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); margin-bottom: 20px; }
.tab {
  padding: 10px 18px; font-size: 13px; font-weight: 600;
  color: var(--gray-600); cursor: pointer; border-bottom: 3px solid transparent;
  margin-bottom: -2px; transition: all 0.15s;
}
.tab:hover { color: var(--primary); }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== SEARCH & FILTER ===== */
.search-box {
  position: relative; display: inline-flex; align-items: center;
}
.search-box i {
  position: absolute; left: 10px; color: var(--gray-600); font-size: 13px;
}
.search-box input {
  padding-left: 32px; padding-right: 12px; height: 36px;
  border: 1px solid var(--gray-300); border-radius: 8px;
  font-size: 13px; outline: none; width: 220px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* ===== PROFILE CARD ===== */
.profile-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #4F46E5, #0EA5E9);
  display: flex; align-items: center; justify-content: center;
  color: white; font-size: 20px; font-weight: 800; flex-shrink: 0;
}
.profile-avatar.lg {
  width: 80px; height: 80px; font-size: 28px;
}

/* =====띠 등급 COLORS ===== */
.grade-1 { background: #F3F4F6; color: #374151; }
.grade-2 { background: #DBEAFE; color: #1D4ED8; }
.grade-3 { background: #D1FAE5; color: #065F46; }
.grade-4 { background: #FEF3C7; color: #92400E; }
.grade-5 { background: #FED7AA; color: #9A3412; }
.grade-6 { background: #FECACA; color: #991B1B; }
.grade-7 { background: #EDE9FE; color: #5B21B6; }
.grade-8 { background: #FCE7F3; color: #9D174D; }
.grade-9 { background: #CFFAFE; color: #155E75; }
.grade-10 { background: linear-gradient(135deg, #FEF3C7, #FED7AA); color: #92400E; }
.grade-11 { background: linear-gradient(135deg, #EDE9FE, #DBEAFE); color: #3730A3; }
.grade-12 { background: linear-gradient(135deg, #FEF9C3, #FDE68A); color: #78350F; border: 1px solid #F59E0B; }

/* ===== GRID LAYOUTS ===== */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ===== ACTIVITY FEED ===== */
.activity-item {
  display: flex; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--gray-100);
}
.activity-item:last-child { border-bottom: none; }
.activity-dot {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.activity-content .name { font-size: 13px; font-weight: 600; color: var(--gray-800); }
.activity-content .desc { font-size: 12px; color: var(--gray-600); margin-top: 2px; }
.activity-content .time { font-size: 11px; color: var(--gray-400); margin-top: 3px; }

/* ===== PROGRESS BAR ===== */
.progress-bar { background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 0.6s ease; }

/* ===== REPORT INPUT GRID ===== */
.report-grid {
  display: grid;
  grid-template-columns: 100px 1fr 80px 80px 1fr;
  gap: 0;
  border: 1px solid var(--gray-300);
  border-radius: 10px;
  overflow: hidden;
}
.report-grid .rg-header {
  background: #F8FAFF; padding: 8px 10px;
  font-size: 11px; font-weight: 700; color: var(--gray-600);
  text-transform: uppercase; border-bottom: 2px solid var(--gray-200);
  border-right: 1px solid var(--gray-200);
}
.report-grid .rg-header:last-child { border-right: none; }
.report-grid .rg-cell {
  padding: 8px 10px; border-bottom: 1px solid var(--gray-100);
  border-right: 1px solid var(--gray-200); font-size: 13px;
}
.report-grid .rg-cell:last-child { border-right: none; }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}
.fade-in { animation: fadeIn 0.3s ease; }
.slide-in { animation: slideInLeft 0.3s ease; }

/* ===== PRINT STYLES ===== */
@media print {
  #sidebar, #topbar { display: none !important; }
  #main-content { margin-left: 0 !important; }
  #page-content { padding: 0 !important; }
  .no-print { display: none !important; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }
  #sidebar { transform: translateX(-240px); }
  #sidebar.mobile-open { transform: translateX(0); width: 240px; }
  #main-content { margin-left: 0; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

/* ===== CUSTOM SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #94A3B8; }

/* ===== NOTIFICATION TOAST ===== */
.toast-container {
  position: fixed; top: 16px; right: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: white; border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  padding: 12px 16px; display: flex; align-items: center; gap: 10px;
  min-width: 280px; animation: slideUp 0.3s ease;
  border-left: 4px solid;
}
.toast-success { border-color: var(--success); }
.toast-error { border-color: var(--danger); }
.toast-info { border-color: var(--primary); }
.toast-warning { border-color: var(--warning); }
.toast .toast-icon { font-size: 16px; }
.toast .toast-text { font-size: 13px; font-weight: 500; color: var(--gray-800); flex: 1; }

/* ===== DETAIL SECTION ===== */
.detail-section {
  background: #F8FAFF; border-radius: 10px;
  padding: 16px; margin-bottom: 14px;
}
.detail-section .ds-title {
  font-size: 12px; font-weight: 700; color: var(--primary);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.info-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
}
.info-item .info-label { font-size: 11px; color: var(--gray-600); margin-bottom: 2px; }
.info-item .info-value { font-size: 13px; font-weight: 600; color: var(--gray-800); }

/* ===== WEEK PERFORMANCE TABLE ===== */
.week-table { border-collapse: collapse; width: 100%; }
.week-table th {
  background: #F0F4FF; padding: 9px 12px;
  font-size: 11px; font-weight: 700; color: #4F46E5;
  text-transform: uppercase; border-bottom: 2px solid #C7D2FE;
}
.week-table td {
  padding: 9px 12px; font-size: 13px;
  border-bottom: 1px solid var(--gray-100);
}
.week-table tr:hover td { background: #F8FAFF; }

/* ===== DOWNLOAD BUTTON SPECIAL ===== */
.download-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 7px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  border: 1px solid; transition: all 0.15s;
}
.download-excel { background: #D1FAE5; color: #065F46; border-color: #6EE7B7; }
.download-excel:hover { background: #A7F3D0; }
.download-image { background: #DBEAFE; color: #1D4ED8; border-color: #93C5FD; }
.download-image:hover { background: #BFDBFE; }
.download-print { background: #F3F4F6; color: #374151; border-color: #D1D5DB; }
.download-print:hover { background: #E5E7EB; }

/* ===== HOME PROJECT CARDS ===== */
.project-card {
  background: white; border-radius: 16px;
  border: 2px solid var(--gray-200);
  padding: 24px; cursor: pointer;
  transition: all 0.2s; position: relative; overflow: hidden;
}
.project-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(79,70,229,0.12);
  transform: translateY(-3px);
}
.project-card.active-project { border-color: var(--primary); }
.project-card .pc-icon {
  width: 56px; height: 56px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; margin-bottom: 14px;
}
.project-card .pc-title { font-size: 18px; font-weight: 800; color: var(--gray-800); }
.project-card .pc-desc { font-size: 13px; color: var(--gray-600); margin-top: 6px; line-height: 1.5; }
.project-card .pc-stats {
  display: flex; gap: 16px; margin-top: 16px;
  padding-top: 14px; border-top: 1px solid var(--gray-100);
}
.project-card .pc-stat .val { font-size: 20px; font-weight: 800; color: var(--gray-800); }
.project-card .pc-stat .lbl { font-size: 11px; color: var(--gray-600); }
.project-card .pc-badge {
  position: absolute; top: 14px; right: 14px;
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 20px;
}

/* ===== REPORT PRINT AREA ===== */
#print-area {
  background: white; padding: 20px; border-radius: 12px;
}
.print-header {
  text-align: center; margin-bottom: 20px;
  border-bottom: 2px solid #4F46E5; padding-bottom: 14px;
}
.print-header h2 { font-size: 20px; font-weight: 800; color: #1e1b4b; }
.print-header p { font-size: 13px; color: #6B7280; margin-top: 4px; }

/* Donut chart text */
.chart-center-text {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center; pointer-events: none;
}
.chart-center-text .big { font-size: 28px; font-weight: 800; color: #1F2937; }
.chart-center-text .small { font-size: 12px; color: #6B7280; }

/* ===== TOOLTIP ===== */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px); left: 50%;
  transform: translateX(-50%);
  background: #1F2937; color: white;
  font-size: 11px; padding: 4px 8px; border-radius: 5px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity 0.2s;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--gray-600);
}
.empty-state i { font-size: 48px; color: var(--gray-300); margin-bottom: 14px; }
.empty-state h4 { font-size: 16px; font-weight: 700; color: var(--gray-700); margin-bottom: 6px; }
.empty-state p { font-size: 13px; }

/* Highlight active days */
.day-has-data { 
  background: #EEF2FF !important; 
  color: var(--primary) !important; 
  font-weight: 700;
}

/* ===== ALLOWANCE CALCULATOR ===== */
.calc-result-box {
  background: linear-gradient(135deg, #1e1b4b, #312e81);
  border-radius: 12px; padding: 20px; color: white;
}
.calc-result-box .res-title { font-size: 12px; color: #a5b4fc; margin-bottom: 4px; }
.calc-result-box .res-value { font-size: 28px; font-weight: 800; }
.calc-result-box .res-breakdown { 
  border-top: 1px solid rgba(255,255,255,0.15); 
  margin-top: 14px; padding-top: 12px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.calc-result-box .rb-item .rb-label { font-size: 11px; color: #c7d2fe; }
.calc-result-box .rb-item .rb-val { font-size: 16px; font-weight: 700; margin-top: 2px; }
