/* Bid Builder Styles */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1e40af;
  --color-success: #10b981;
  --color-danger: #ef4444;
  --color-warning: #f59e0b;
  --color-gray-50: #f9fafb;
  --color-gray-100: #f3f4f6;
  --color-gray-200: #e5e7eb;
  --color-gray-300: #d1d5db;
  --color-gray-600: #4b5563;
  --color-gray-700: #374151;
  --color-gray-900: #111827;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--color-gray-50);
  color: var(--color-gray-900);
  line-height: 1.6;
}

/* Header */
.app-header {
  background: white;
  border-bottom: 1px solid var(--color-gray-200);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}

.header-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: var(--color-gray-600);
  flex: 1;
}

.breadcrumb a {
  color: var(--color-primary);
  text-decoration: none;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

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

/* Layout */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.builder-container {
  display: flex;
  flex: 1;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  gap: 0;
}

/* Sidebar */
.builder-sidebar {
  width: 280px;
  background: white;
  border-right: 1px solid var(--color-gray-200);
  padding: 1.5rem;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-section {
  margin-bottom: 2rem;
}

.sidebar-section h3 {
  font-size: 0.875rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--color-gray-600);
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}

.proposal-list {
  margin-bottom: 1rem;
  max-height: 200px;
  overflow-y: auto;
}

.proposal-item {
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--color-gray-200);
  border-radius: 4px;
  cursor: pointer;
  background: white;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.proposal-item:hover {
  background: var(--color-gray-50);
  border-color: var(--color-primary);
}

.proposal-item.active {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

.template-item,
.quick-action {
  display: block;
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 0.5rem;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 4px;
  cursor: pointer;
  text-align: left;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.template-item:hover,
.quick-action:hover {
  background: var(--color-gray-100);
  border-color: var(--color-primary);
}

/* Main Editor */
.builder-main {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  text-align: center;
  color: var(--color-gray-600);
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

.empty-state h2 {
  color: var(--color-gray-900);
  margin-bottom: 0.5rem;
}

/* Proposal Editor */
.proposal-editor {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

.editor-section {
  padding: 2rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.editor-section:last-of-type {
  border-bottom: none;
}

.section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-gray-900);
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

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

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

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-gray-700);
  margin-bottom: 0.5rem;
}

.form-control,
.form-control-sm {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--color-gray-300);
  border-radius: 4px;
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.form-control-sm {
  padding: 0.5rem;
  font-size: 0.8125rem;
}

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

/* Tables */
.items-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.items-table th {
  background: var(--color-gray-50);
  padding: 0.75rem;
  text-align: left;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--color-gray-700);
  border-bottom: 2px solid var(--color-gray-200);
}

.items-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-gray-200);
}

.items-table input {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--color-gray-300);
  border-radius: 4px;
  font-size: 0.875rem;
}

.items-table tr:hover {
  background: var(--color-gray-50);
}

.items-summary {
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 4px;
  padding: 1rem;
  max-width: 300px;
  margin-left: auto;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0;
  font-size: 0.875rem;
}

.summary-row.total {
  border-top: 2px solid var(--color-gray-300);
  padding-top: 1rem;
  margin-top: 1rem;
  font-weight: 600;
  font-size: 1rem;
}

.amount {
  font-weight: 600;
  color: var(--color-primary);
  font-family: "Courier New", monospace;
}

/* Certifications */
.certifications-list {
  display: grid;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.certification-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 4px;
  font-size: 0.875rem;
}

.certification-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  font-weight: 500;
}

/* Attachments */
.attachments-list {
  display: grid;
  gap: 0.75rem;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem;
  background: var(--color-gray-50);
  border: 1px solid var(--color-gray-200);
  border-radius: 4px;
  font-size: 0.875rem;
}

.attachment-name {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
}

/* Buttons */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  white-space: nowrap;
}

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

.btn-primary:hover {
  background: var(--color-primary-dark);
}

.btn-secondary {
  background: white;
  color: var(--color-gray-900);
  border: 1px solid var(--color-gray-300);
}

.btn-secondary:hover {
  background: var(--color-gray-50);
  border-color: var(--color-gray-400);
}

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

.btn-success:hover {
  background: #059669;
}

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  cursor: pointer;
  font-size: 1.25rem;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: var(--color-gray-100);
}

/* Editor Actions */
.editor-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  padding: 2rem;
  border-top: 1px solid var(--color-gray-200);
  background: white;
  flex-wrap: wrap;
}

/* Modal */
.modal {
  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;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  max-width: 800px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}

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

.modal-header h2 {
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--color-gray-600);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--color-gray-900);
}

.modal-body {
  padding: 1.5rem;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  padding: 1rem 1.5rem;
  background: var(--color-gray-900);
  color: white;
  border-radius: 4px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  max-width: 400px;
  animation: slideIn 0.3s ease-out;
}

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

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

.toast.warning {
  background: var(--color-warning);
}

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

/* Preview */
.preview-content {
  font-family: Arial, sans-serif;
  padding: 2rem;
  background: white;
  page-break-after: always;
}

.preview-header {
  text-align: center;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--color-gray-900);
  padding-bottom: 1rem;
}

.preview-company {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--color-primary);
}

.preview-title {
  font-size: 1.25rem;
  margin-top: 0.5rem;
  color: var(--color-gray-900);
}

.preview-summary {
  margin: 2rem 0;
  padding: 1rem;
  background: var(--color-gray-50);
  border-left: 4px solid var(--color-primary);
}

.preview-items {
  margin: 2rem 0;
}

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

.preview-items th,
.preview-items td {
  border: 1px solid var(--color-gray-300);
  padding: 0.75rem;
  text-align: right;
}

.preview-items th {
  background: var(--color-gray-100);
  text-align: left;
  font-weight: 600;
}

.preview-items td:first-child {
  text-align: left;
}

.preview-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-gray-300);
  font-size: 0.875rem;
  color: var(--color-gray-600);
}

/* Responsive */
@media (max-width: 768px) {
  .builder-container {
    flex-direction: column;
  }

  .builder-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--color-gray-200);
    max-height: 200px;
    overflow-x: auto;
  }

  .sidebar-section {
    display: inline-block;
    margin-right: 2rem;
    margin-bottom: 0;
    vertical-align: top;
  }

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

  .editor-actions {
    justify-content: flex-start;
  }

  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.8125rem;
  }
}
