@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/icon?family=Material+Icons');
@import url('variables.css');

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--text-primary);
  background: var(--content-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== LAYOUT ===== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.sidebar-logo-img {
  max-height: 36px;
  max-width: 180px;
  object-fit: contain;
  filter: brightness(0) invert(1);
}

.sidebar-logo .logo-text {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.5px;
}

.sidebar-logo .logo-text span { color: var(--primary-blue); }

.sidebar-logo .logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--primary-blue);
  border-radius: 6px;
  margin-right: 10px;
}

.sidebar-logo .logo-icon svg { width: 20px; height: 20px; fill: white; }

.sidebar-toggle {
  background: none;
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  padding: 4px;
  border-radius: 4px;
  transition: var(--transition);
}

.sidebar-toggle:hover { background: rgba(255,255,255,0.1); }

.nav-group { padding: 12px 0; }

.nav-group-label {
  padding: 8px 20px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(166, 176, 207, 0.6);
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.05);
  color: #ffffff;
}

.nav-item.active {
  background: rgba(0, 150, 218, 0.1);
  color: #ffffff;
  border-left-color: var(--sidebar-active);
}

.nav-item .material-icons {
  font-size: 20px;
  margin-right: 12px;
  opacity: 0.8;
}

.nav-item.active .material-icons { opacity: 1; color: var(--sidebar-active); }

/* Collapsed Sidebar (Desktop) */
.sidebar.collapsed {
  width: 60px;
}
.sidebar.collapsed .sidebar-logo {
  padding: 16px 0;
  justify-content: center;
}
.sidebar.collapsed .nav-group-label {
  display: none;
}
.sidebar.collapsed .nav-item {
  width: 60px;
  justify-content: center;
  padding: 10px 0;
}

.sidebar.collapsed .nav-text {
  display: none;
}

.sidebar.collapsed .nav-item .material-icons {
  margin-right: 0;
}
.sidebar.collapsed .nav-item .material-icons {
  color: var(--sidebar-text);
}
.sidebar.collapsed .nav-item.active .material-icons {
  color: var(--sidebar-active);
}
.sidebar.collapsed ~ .main-wrapper {
  margin-left: 60px;
}
.sidebar.collapsed .sidebar-toggle {
  margin: 0 auto !important;
}

/* ===== MAIN CONTENT AREA ===== */
.main-wrapper {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ===== HEADER ===== */
.header {
  height: var(--header-height);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-company-logo {
  height: 38px;
  max-width: 200px;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-help {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primary-blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  font-weight: 700;
  transition: var(--transition);
}

.header-help:hover { transform: scale(1.1); }

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--content-bg);
  border-radius: 20px;
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
}

.header-user:hover { background: var(--border-color); }

/* ===== CONTENT ===== */
.content {
  flex: 1;
  padding: 24px;
  background: var(--content-bg);
}

/* ===== CARDS ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  transition: var(--transition);
}

.card:hover { box-shadow: var(--shadow-lg); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--primary-blue); color: white; }
.btn-success { background: var(--success-green); color: white; }
.btn-warning { background: var(--warning-orange); color: white; }
.btn-danger { background: var(--danger-red); color: white; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}
.btn-outline:hover { background: var(--content-bg); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-lg { padding: 12px 24px; font-size: 15px; }

.btn .material-icons { font-size: 18px; }

/* ===== FORM ELEMENTS ===== */
.form-group {
  margin-bottom: 16px;
}

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

.form-control {
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
  transition: var(--transition);
  background: white;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(0,150,218,0.15);
}

select.form-control { appearance: auto; }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; }

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

table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  background: var(--content-bg);
  border-bottom: 2px solid var(--border-color);
}

table td {
  padding: 12px 14px;
  font-size: 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

table tr:hover td { background: rgba(0,150,218,0.03); }

/* ===== TABS ===== */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 20px;
  gap: 0;
}

.tab {
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: var(--transition);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  font-family: inherit;
}

.tab:hover { color: var(--primary-blue); }
.tab.active {
  color: var(--primary-blue);
  border-bottom-color: var(--primary-blue);
  font-weight: 600;
}

/* ===== BADGES ===== */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-draft { background: #e9ecef; color: #495057; }
.badge-sent { background: #cce5ff; color: #004085; }
.badge-approved { background: #d4edda; color: #155724; }
.badge-rejected { background: #f8d7da; color: #721c24; }
.badge-green { background: var(--success-green); color: white; }
.badge-orange { background: var(--warning-orange); color: white; }
.badge-blue { background: var(--primary-blue); color: white; }

/* ===== TOGGLE SWITCH ===== */
.toggle {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #ccc;
  border-radius: 24px;
  transition: var(--transition);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: var(--transition);
}

.toggle input:checked + .toggle-slider { background: var(--success-green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(22px); }

.toggle-label {
  font-size: 10px;
  font-weight: 600;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  color: white;
  pointer-events: none;
}

.toggle-label.on { left: 6px; display: none; }
.toggle-label.off { right: 6px; display: block; color: #666; }
.toggle input:checked ~ .toggle-label.on { display: block; }
.toggle input:checked ~ .toggle-label.off { display: none; }

/* ===== SEARCH BAR ===== */
.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 400px;
}

.search-bar input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 14px;
}

.search-bar input:focus {
  outline: none;
  border-color: var(--primary-blue);
}

/* ===== PAGE HEADER ===== */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.page-title {
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== FILTERS ===== */
.filter-row {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.filter-row select, .filter-row input {
  padding: 8px 12px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  background: white;
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}

.modal-overlay.active { opacity: 1; visibility: visible; }

.modal {
  background: white;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px);
  transition: var(--transition);
}

.modal-overlay.active .modal { transform: translateY(0); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  transition: var(--transition);
}

.modal-close:hover { background: var(--content-bg); color: var(--danger-red); }

.modal-body { padding: 24px; }

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--border-color);
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius);
  color: white;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toastSlide 0.3s ease;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 280px;
}

.toast-success { background: var(--success-green); }
.toast-error { background: var(--danger-red); }
.toast-info { background: var(--primary-blue); }

@keyframes toastSlide {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===== QUOTE SPECIFIC ===== */
.quote-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 20px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}

.quote-card:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-1px);
}

.quote-number {
  font-weight: 700;
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 4px;
  color: white;
}

.quote-number.q { background: var(--success-green); }
.quote-number.o { background: var(--warning-orange); }

.quote-info { flex: 1; }
.quote-info .customer-name { font-weight: 600; font-size: 15px; }
.quote-info .quote-date { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

.quote-total {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary-blue);
  padding: 4px 14px;
  background: rgba(0,150,218,0.08);
  border-radius: 4px;
}

.quote-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

/* ===== ROOM SECTIONS (Quote Detail) ===== */
.room-section {
  margin-bottom: 20px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.room-header {
  background: var(--room-header);
  color: white;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 14px;
  cursor: grab;
}

.room-header .room-info { display: flex; gap: 20px; align-items: center; }
.room-header .room-actions { display: flex; gap: 8px; }
.room-header .room-actions button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  transition: var(--transition);
}
.room-header .room-actions button:hover { background: rgba(255,255,255,0.3); }

.product-row {
  background: var(--product-row);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(0,0,0,0.08);
  font-size: 14px;
}

.product-row .product-name { flex: 1; font-weight: 500; }
.product-row .product-qty { width: 60px; text-align: center; }
.product-row .product-price { width: 100px; text-align: right; font-weight: 600; }
.product-row .price-original {
  text-decoration: line-through;
  color: var(--text-muted);
  font-size: 12px;
  margin-right: 6px;
}

.add-product-area {
  border: 2px dashed var(--border-color);
  padding: 16px;
  text-align: center;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  margin: 8px 20px 16px;
  border-radius: var(--radius);
}

.add-product-area:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  background: rgba(0,150,218,0.03);
}

/* ===== EMPTY STATE ===== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
}

.empty-state .material-icons { font-size: 64px; opacity: 0.3; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; margin-bottom: 8px; color: var(--text-primary); }
.empty-state p { font-size: 14px; margin-bottom: 20px; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-wrapper { margin-left: 0; }
  .content { padding: 16px; }
  .page-header { flex-direction: column; align-items: flex-start; }
}

/* ===== UTILITIES ===== */
.d-flex { display: flex; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }
.fw-600 { font-weight: 600; }
.text-danger { color: var(--danger-red); }
.text-success { color: var(--success-green); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }

/* ===== SEARCH DROPDOWN ===== */
.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 200;
  max-height: 260px;
  overflow-y: auto;
}

.search-dropdown-item {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  transition: var(--transition);
}

.search-dropdown-item:hover {
  background: rgba(0,150,218,0.06);
}

.search-dropdown-item:last-child {
  border-bottom: none;
}

/* ===== WIDE MODAL ===== */
.modal.modal-wide {
  max-width: 800px;
}

@media (max-width: 768px) {
  .grid-2 { grid-template-columns: 1fr; }
}
/* ===== BULK ACTION BAR ===== */
.bulk-action-bar {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--sidebar-bg);
  color: white;
  padding: 12px 24px;
  border-radius: 40px;
  display: flex;
  align-items: center;
  gap: 24px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
  z-index: 1000;
  transition: bottom 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.bulk-action-bar.active {
  bottom: 30px;
}

.bulk-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
  font-size: 14px;
}

.selected-count {
  background: var(--primary-blue);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
}

.bulk-actions {
  display: flex;
  gap: 8px;
  border-left: 1px solid rgba(255,255,255,0.1);
  padding-left: 24px;
}

/* Custom Checkbox Styling */
.custom-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-blue);
}

.select-all-container {
  display: flex;
  align-items: center;
  justify-content: center;
}
