/* PAMTTON Quote System - Styles */
:root {
  --primary: #0a1929;
  --primary-light: #1a3a5c;
  --accent: #0066cc;
  --accent-light: #e6f0ff;
  --success: #25D366;
  --danger: #dc3545;
  --warning: #ffa726;
  --bg: #f5f7fa;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-light: #6c757d;
  --border: #e0e4e8;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;
  --radius-sm: 8px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===== Login ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 20px;
}
.login-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 40px 32px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
.login-logo {
  text-align: center;
  margin-bottom: 24px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 2px;
  color: var(--primary);
}
.login-card input {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  margin-bottom: 16px;
  transition: border-color 0.2s;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
}
.login-card button {
  width: 100%;
  padding: 14px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.login-card button:hover { background: #0052b3; }
.login-error {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 12px;
  text-align: center;
}

/* ===== App Layout ===== */
.app-header {
  background: var(--primary);
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.app-header .logo {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 1px;
}
.app-header nav {
  display: flex;
  gap: 8px;
  align-items: center;
}
.app-header nav button, .app-header nav select {
  padding: 8px 16px;
  background: transparent;
  color: white;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.app-header nav button:hover, .app-header nav select:hover {
  background: rgba(255,255,255,0.1);
}
.app-header nav button.active {
  background: var(--accent);
  border-color: var(--accent);
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  font-size: 18px;
  margin-bottom: 16px;
  color: var(--primary);
}
.card h3 {
  font-size: 15px;
  margin-bottom: 12px;
  color: var(--text);
}

/* ===== Form Elements ===== */
.form-group {
  margin-bottom: 12px;
}
.form-group label {
  display: block;
  font-size: 13px;
  color: var(--text-light);
  margin-bottom: 4px;
  font-weight: 500;
}
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  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(--accent);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
@media (max-width: 600px) {
  .form-row { grid-template-columns: 1fr; }
}

/* ===== Product Selector ===== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.product-card {
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--card-bg);
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.product-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0,102,204,0.15);
}
.product-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.product-card .product-image-wrap {
  height: 160px;
  background: #f8fafc;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.product-card .product-image-wrap img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.product-card .product-info {
  padding: 14px;
}
.product-card .model {
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
}
.product-card .series {
  font-size: 12px;
  color: var(--text-light);
}
.product-card .price {
  font-size: 20px;
  font-weight: 800;
  color: var(--accent);
  margin-top: 8px;
}
.product-card .specs {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}
.product-card .badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: var(--warning);
  color: white;
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 10px;
  font-weight: 600;
}

/* ===== Quote Items ===== */
.quote-items {
  margin-bottom: 16px;
}
.quote-item {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  position: relative;
  box-shadow: var(--shadow);
}
.quote-item-main {
  display: flex;
  gap: 16px;
  margin-bottom: 12px;
}
.quote-item-image {
  width: 140px;
  min-width: 140px;
  height: 160px;
  background: #f8fafc;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--border);
}
.quote-item-image img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.quote-item-body {
  flex: 1;
  min-width: 0;
}
.quote-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 8px;
}
.quote-item-header .model {
  font-weight: 700;
  font-size: 18px;
  color: var(--primary);
  display: block;
}
.quote-item-header .series {
  font-size: 12px;
  color: var(--text-light);
}
.quote-item-header .remove-btn {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}
.quote-item-header .remove-btn:hover {
  background: var(--danger);
  color: white;
}
.quote-item-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 10px;
}
.quote-item-fields .field label {
  color: var(--text-light);
  font-size: 11px;
  display: block;
  margin-bottom: 3px;
  font-weight: 500;
}
.quote-item-fields .field input {
  width: 100%;
  padding: 8px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.quote-item-fields .field input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== Color / Variant Selector ===== */
.color-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.color-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 64px;
}
.color-option:hover {
  border-color: var(--accent);
}
.color-option.selected {
  border-color: var(--accent);
  background: var(--accent-light);
}
.color-option img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 4px;
  background: #f8fafc;
}
.color-option span {
  font-size: 11px;
  color: var(--text-light);
  text-align: center;
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ===== Accessories Section ===== */
.accessories-section {
  border-top: 1px dashed var(--border);
  padding-top: 12px;
  margin-top: 12px;
}
.accessory-group {
  margin-bottom: 14px;
}
.accessory-group .group-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 8px;
}
.accessory-group .group-title small {
  font-weight: 400;
  color: var(--text-light);
}
.accessory-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.accessory-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 86px;
  background: var(--card-bg);
}
.accessory-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.accessory-card.selected {
  border-color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 2px 8px rgba(0,102,204,0.12);
}
.accessory-card input[type="checkbox"] {
  display: none;
}
.accessory-card .acc-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  margin-bottom: 6px;
}
.accessory-card .acc-name {
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.3;
  max-width: 90px;
}
.accessory-card .acc-price {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}
.quote-item-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 2px solid var(--border);
  font-weight: 700;
}
.quote-item-total .amount {
  font-size: 20px;
  color: var(--accent);
}

/* ===== Summary ===== */
.summary-card {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 16px;
}
.summary-card .row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}
.summary-card .row.total {
  border-top: 1px solid rgba(255,255,255,0.3);
  margin-top: 8px;
  padding-top: 12px;
  font-size: 22px;
  font-weight: 800;
}

/* ===== Buttons ===== */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}
.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: #0052b3; }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #1da851; }
.btn-outline { background: transparent; color: var(--accent); border: 2px solid var(--accent); }
.btn-outline:hover { background: var(--accent); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-block { width: 100%; justify-content: center; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ===== History Table ===== */
.history-table {
  width: 100%;
  border-collapse: collapse;
}
.history-table th, .history-table td {
  padding: 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.history-table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--text-light);
  font-size: 12px;
  text-transform: uppercase;
}
.history-table tr:hover { background: var(--accent-light); }
.history-table .actions { display: flex; gap: 4px; }
.history-table .actions button {
  padding: 4px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  cursor: pointer;
}
.history-table .actions button:hover { background: var(--accent); color: white; }

/* ===== Document Preview ===== */
.doc-preview {
  background: white;
  max-width: 800px;
  margin: 0 auto;
  padding: 40px;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
}
.doc-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--primary);
}
.doc-header .company {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}
.doc-header .company-info {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 4px;
}
.doc-title {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin: 24px 0;
  color: var(--primary);
}
.doc-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 13px;
}
.doc-meta .meta-row {
  display: flex;
  gap: 8px;
}
.doc-meta .meta-row .label {
  font-weight: 600;
  color: var(--text-light);
  min-width: 80px;
}
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 16px;
}
.doc-table th {
  background: var(--primary);
  color: white;
  padding: 10px;
  font-size: 12px;
  text-align: left;
}
.doc-table td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.doc-table tfoot td {
  border-top: 2px solid var(--primary);
  font-weight: 700;
  background: var(--bg);
}
.doc-footer {
  margin-top: 32px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-light);
}
.doc-signature {
  margin-top: 40px;
  text-align: right;
  font-size: 13px;
}

/* ===== Print ===== */
@media print {
  body { background: white; }
  .app-header, .app-container > .card, .no-print { display: none !important; }
  .doc-preview {
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    max-width: 100%;
  }
  .print-only { display: block !important; }
}
.print-only { display: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .app-header { padding: 10px 12px; }
  .app-header .logo { font-size: 16px; }
  .app-header nav button, .app-header nav select {
    padding: 6px 10px;
    font-size: 12px;
  }
  .app-container { padding: 12px; }
  .card { padding: 16px; }
  .product-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .product-card .product-image-wrap { height: 130px; }
  .quote-item-main {
    flex-direction: column;
    gap: 12px;
  }
  .quote-item-image {
    width: 100%;
    height: 180px;
  }
  .quote-item-fields { grid-template-columns: repeat(2, 1fr); }
  .accessory-options { gap: 8px; }
  .accessory-card { min-width: 76px; padding: 8px; }
  .accessory-card .acc-icon { width: 38px; height: 38px; font-size: 18px; }
  .doc-preview { padding: 20px; }
  .doc-header { flex-direction: column; }
  .doc-meta { grid-template-columns: 1fr; }
  .history-table { font-size: 12px; }
  .history-table th, .history-table td { padding: 8px 4px; }
}
@media (max-width: 480px) {
  .product-grid { grid-template-columns: 1fr; }
  .quote-item-fields { grid-template-columns: 1fr 1fr; }
  .color-option img { width: 40px; height: 40px; }
}

/* ===== Empty State ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }

/* ===== Loading ===== */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-light);
}
.spinner {
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}
@keyframes spin { to { transform: rotate(360deg); } }
