/* TGSystem Estimate - 태건시스템 견적서 */
:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #0f172a;
  --bg: #f8fafc;
  --card: #ffffff;
  --border: #e2e8f0;
  --text: #1e293b;
  --text-light: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --sidebar-w: 240px;
}

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

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

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

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background: var(--secondary);
  color: white;
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
}

.sidebar-brand {
  padding: 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand h2 {
  font-size: 18px;
  font-weight: 700;
}

.sidebar-brand small {
  color: #94a3b8;
  font-size: 12px;
}

.sidebar-menu {
  list-style: none;
  padding: 12px 0;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  color: #cbd5e1;
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
}

.sidebar-menu li a:hover,
.sidebar-menu li a.active {
  background: rgba(255,255,255,0.1);
  color: white;
}

.sidebar-menu li a .icon {
  width: 20px;
  text-align: center;
}

.sidebar-user {
  position: absolute;
  bottom: 0;
  width: 100%;
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-user img {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.sidebar-user .user-info {
  flex: 1;
}

.sidebar-user .user-name {
  font-size: 13px;
  font-weight: 600;
}

.sidebar-user .user-email {
  font-size: 11px;
  color: #94a3b8;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 24px;
}

/* Header */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
}

.page-header .breadcrumb {
  font-size: 13px;
  color: var(--text-light);
}

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.card-header h3 {
  font-size: 16px;
  font-weight: 600;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}

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

.stat-card .stat-label {
  font-size: 13px;
  color: var(--text-light);
  margin-top: 4px;
}

/* Table */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

table th {
  background: #f1f5f9;
  font-weight: 600;
  color: var(--text-light);
  font-size: 12px;
  text-transform: uppercase;
}

table tr:hover {
  background: #f8fafc;
}

/* Status Badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.badge-draft { background: #f1f5f9; color: #64748b; }
.badge-sent { background: #dbeafe; color: #2563eb; }
.badge-accepted { background: #d1fae5; color: #059669; }
.badge-completed { background: #e0e7ff; color: #4338ca; }
.badge-cancelled { background: #fee2e2; color: #dc2626; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f1f5f9; color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: #e2e8f0; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 6px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

/* Items Table (견적 품목) */
.items-table {
  width: 100%;
  margin-top: 12px;
}

.items-table th {
  background: var(--primary);
  color: white;
  font-size: 12px;
}

.items-table td input {
  width: 100%;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 13px;
}

.items-table .amount-cell {
  text-align: right;
  font-weight: 600;
  white-space: nowrap;
}

/* Totals */
.totals-section {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.totals-table {
  width: 300px;
}

.totals-table td {
  padding: 8px 16px;
}

.totals-table .total-row {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  border-top: 2px solid var(--secondary);
}

/* Login Page */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
}

.login-card {
  background: white;
  border-radius: 16px;
  padding: 48px;
  width: 400px;
  text-align: center;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.login-card h1 {
  font-size: 24px;
  margin-bottom: 8px;
}

.login-card p {
  color: var(--text-light);
  margin-bottom: 32px;
}

.google-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 32px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.google-btn:hover {
  background: #f8fafc;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.google-btn img {
  width: 20px;
  height: 20px;
}

/* PDF Preview */
.pdf-preview {
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px;
  max-width: 800px;
  margin: 0 auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  padding: 12px 24px;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  z-index: 9999;
  animation: slideIn 0.3s ease;
}

.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* Mobile Nav Toggle */
.mobile-nav-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  background: var(--secondary);
  color: white;
  border: none;
  border-radius: 8px;
  width: 40px;
  height: 40px;
  font-size: 20px;
  cursor: pointer;
}

/* Responsive */
@media (max-width: 768px) {
  .mobile-nav-toggle { display: block; }
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
    padding: 16px;
    padding-top: 60px;
  }
  .page-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .page-header h1 { font-size: 20px; }
  .form-row { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .card { padding: 14px; }
  table th, table td { padding: 8px 10px; font-size: 12px; }
  .items-table td input { padding: 6px; font-size: 12px; }
  .totals-table { width: 100%; }
  .btn { padding: 8px 14px; font-size: 13px; }
  .btn-sm { padding: 5px 10px; font-size: 11px; }
  .modal { width: 95%; padding: 20px; }
}
