/* Main CSS for Business Quote Generator */

/* ===== Base Styles ===== */
:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --light-color: #ecf0f1;
  --dark-color: #2c3e50;
  --text-color: #333;
  --border-color: #ddd;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --danger-color: #e74c3c;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  color: var(--text-color);
  background-color: #f5f7fa;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 0.5em;
  color: var(--dark-color);
}

h1 {
  font-size: 2.2rem;
}

h2 {
  font-size: 1.8rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  margin-bottom: 1rem;
}

/* ===== Layout ===== */
.app-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  margin: 2rem 0;
}

.app-section {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.section-header h2 {
  margin-bottom: 0;
  display: flex;
  align-items: center;
}

.section-header h2 i {
  margin-right: 0.5rem;
  color: var(--secondary-color);
}

.section-actions {
  display: flex;
  gap: 0.75rem;
}

/* ===== Header & Footer ===== */
.app-header {
  background-color: var(--primary-color);
  color: white;
  padding: 1.5rem 0;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.app-header h1 {
  color: white;
  margin-bottom: 0.25rem;
}

.app-header .tagline {
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.1rem;
  margin-bottom: 0;
}

.app-footer {
  background-color: var(--primary-color);
  color: white;
  padding: 1.5rem 0;
  margin-top: 3rem;
  text-align: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  border-radius: 4px;
  cursor: pointer;
  transition: var(--transition);
  border: none;
  outline: none;
}

.btn i {
  margin-right: 0.5rem;
}

.btn-primary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-primary:hover {
  background-color: #2980b9;
}

.btn-secondary {
  background-color: #95a5a6;
  color: white;
}

.btn-secondary:hover {
  background-color: #7f8c8d;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover {
  background-color: #c0392b;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-color);
}

.btn-sm {
  padding: 0.25rem 0.75rem;
  font-size: 0.85rem;
}

/* ===== Forms ===== */
.form-container {
  margin-bottom: 2rem;
}

.form-container.hidden {
  display: none;
}

.card {
  background-color: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.card-header {
  padding: 1rem 1.5rem;
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-body {
  padding: 1.5rem;
}

.card-footer {
  padding: 1rem 1.5rem;
  background-color: #f8f9fa;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.form-row.three-columns {
  grid-template-columns: 1fr 1fr 1fr;
}

label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

input, textarea, select {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
  transition: var(--transition);
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--secondary-color);
  box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.2);
}

input[readonly] {
  background-color: #f8f9fa;
  cursor: not-allowed;
}

.help-text {
  font-size: 0.85rem;
  color: #7f8c8d;
  margin-top: 0.25rem;
}

/* ===== Tables ===== */
.table-responsive {
  overflow-x: auto;
}

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

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: #f8f9fa;
  font-weight: 600;
}

.data-table tbody tr:hover {
  background-color: rgba(236, 240, 241, 0.5);
}

.data-table .actions {
  display: flex;
  gap: 0.5rem;
}

.data-table .btn-icon {
  padding: 0.25rem;
  font-size: 0.9rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

/* ===== Quote Creation Styles ===== */
.quote-form {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.quote-card {
  margin-bottom: 0;
}

/* ===== Services Sidebar and Quote Builder ===== */
.quote-builder-container {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 1.5rem;
}

/* Services Sidebar */
.services-sidebar {
  background-color: white;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 1rem 1.5rem;
  background-color: #f8f9fa;
  border-bottom: 1px solid var(--border-color);
}

.sidebar-header h3 {
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
}

.sidebar-header h3 i {
  margin-right: 0.5rem;
  color: var(--secondary-color);
}

.sidebar-content {
  padding: 1rem;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.services-filter {
  margin-bottom: 1rem;
}

.services-filter input,
.services-filter select {
  margin-bottom: 0.5rem;
}

.services-list {
  overflow-y: auto;
  flex-grow: 1;
  padding-right: 0.5rem;
}

/* Draggable Service Items */
.service-item {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
  cursor: grab;
  transition: var(--transition);
  position: relative;
}

.service-item:hover {
  border-color: var(--secondary-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.service-item.dragging {
  opacity: 0.6;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.service-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.5rem;
}

.service-item-name {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.service-item-category {
  font-size: 0.8rem;
  background-color: #f8f9fa;
  padding: 0.2rem 0.5rem;
  border-radius: 3px;
  color: var(--dark-color);
}

.service-item-cost {
  font-weight: 600;
  color: var(--dark-color);
}

.service-item-description {
  font-size: 0.9rem;
  color: #7f8c8d;
  margin-bottom: 0.5rem;
}

.service-item-unit {
  font-size: 0.85rem;
  color: #7f8c8d;
}

.service-item-drag-handle {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  color: #95a5a6;
  font-size: 0.9rem;
}

/* Quote Items Container */
.quote-items-container {
  min-height: 200px;
  border: 2px dashed var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  background-color: #f8f9fa;
  transition: var(--transition);
}

.quote-items-container.drag-over {
  border-color: var(--secondary-color);
  background-color: rgba(52, 152, 219, 0.1);
}

.empty-message {
  text-align: center;
  color: #7f8c8d;
  padding: 2rem 0;
}

/* Quote Item Styles */
.quote-item {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
  transition: var(--transition);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
}

.quote-item:hover {
  border-color: var(--secondary-color);
}

.quote-item-info {
  flex: 1;
  min-width: 200px;
}

.quote-item-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.quote-item-description {
  font-size: 0.9rem;
  color: #7f8c8d;
  margin-bottom: 0.25rem;
}

.quote-item-cost {
  font-size: 0.9rem;
}

.quote-item-multiplier {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
}

.quote-item-multiplier label {
  margin-bottom: 0;
  white-space: nowrap;
}

.quote-item-multiplier input {
  width: 80px;
  padding: 0.5rem;
}

.quote-item-total {
  font-weight: 600;
  padding: 0 1rem;
  text-align: right;
  min-width: 120px;
}

.quote-item-actions {
  display: flex;
  gap: 0.5rem;
}

.quote-item-actions button {
  padding: 0.25rem;
  font-size: 0.9rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
}

/* Quote Summary Styles */
.quote-summary {
  padding: 1rem;
  background-color: #f8f9fa;
  border-radius: 6px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.summary-row:last-child {
  border-bottom: none;
}

.summary-total {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--dark-color);
  border-top: 2px solid var(--dark-color);
  margin-top: 0.5rem;
  padding-top: 0.5rem;
}

/* Enhanced Quote Summary Styles */
.quote-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.quote-summary-actions .form-group {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}

.summary-category {
  color: var(--secondary-color);
  font-weight: 500;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border-color);
}

.summary-category:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.summary-subtotal {
  font-weight: 600;
  color: var(--dark-color);
}

.summary-tax {
  color: var(--accent-color);
}

/* Animation for cost changes */
@keyframes highlight {
  0% { background-color: rgba(52, 152, 219, 0.2); }
  100% { background-color: transparent; }
}

.highlight-change {
  animation: highlight 1.5s ease;
}

/* ===== Quotes List Styles ===== */
.quotes-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1rem;
}

.quotes-list .empty-message {
  grid-column: 1 / -1;
}

/* ===== Placeholder Content ===== */
.placeholder-content {
  background-color: #f8f9fa;
  border: 1px dashed var(--border-color);
  border-radius: 6px;
  padding: 1.5rem;
  text-align: center;
  color: #7f8c8d;
}

.placeholder-content ul {
  text-align: left;
  margin: 1rem 0 0 1.5rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 992px) {
  .quote-builder-container {
    grid-template-columns: 1fr;
  }
  
  .services-sidebar {
    margin-bottom: 1.5rem;
    max-height: 300px;
  }
}

@media (max-width: 768px) {
  .form-row,
  .form-row.three-columns {
    grid-template-columns: 1fr;
  }
  
  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }
  
  .section-actions {
    width: 100%;
  }
  
  .data-table .actions {
    flex-direction: column;
  }
  
  .quotes-list {
    grid-template-columns: 1fr;
  }
  
  .quote-item {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .quote-item-multiplier,
  .quote-item-total,
  .quote-item-actions {
    margin-top: 0.75rem;
    padding: 0;
  }
  
  .quote-summary-actions {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .quote-summary-actions .form-group {
    width: 100%;
  }
}

@media (min-width: 992px) {
  .app-layout {
    grid-template-columns: 2fr 1fr;
  }
  
  #service-management,
  #quote-creation {
    grid-column: 1 / -1;
  }
}