/* Invoice Template Styles */

.invoice-preview {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 2rem;
  margin: 1rem 0;
  font-family: "Times New Roman", serif;
  max-width: 8.5in;
  margin: 0 auto;
}

.invoice-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2rem;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--primary-color);
}

.invoice-logo {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.invoice-logo img {
  max-height: 80px;
  max-width: 200px;
}

.company-info h1 {
  color: var(--primary-color);
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
}

.company-info p {
  margin: 0.25rem 0;
  color: var(--text-secondary);
}

.invoice-meta {
  text-align: right;
}

.invoice-title {
  font-size: 2rem;
  color: var(--primary-color);
  margin-bottom: 1rem;
}

.invoice-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.bill-to h3,
.invoice-info h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.1rem;
}

.bill-to p,
.invoice-info p {
  margin: 0.25rem 0;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin: 2rem 0;
}

.invoice-table th {
  background: var(--primary-color);
  color: white;
  padding: 0.75rem;
  text-align: left;
  font-weight: 600;
}

.invoice-table td {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.invoice-table .amount {
  text-align: right;
}

.invoice-totals {
  margin-left: auto;
  width: 300px;
  margin-top: 1rem;
}

.total-row {
  display: grid;
  grid-template-columns: 1fr auto;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
}

.total-row.final {
  font-weight: bold;
  font-size: 1.1rem;
  border-bottom: 2px solid var(--primary-color);
  border-top: 2px solid var(--primary-color);
  margin-top: 0.5rem;
}

.invoice-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.payment-terms {
  background: rgba(37, 99, 235, 0.05);
  padding: 1rem;
  border-radius: 6px;
  margin-bottom: 1rem;
}

.payment-terms h4 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.payment-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.payment-methods h4,
.notes h4 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

/* Print Styles */
@media print {
  .invoice-preview {
    border: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .invoice-header {
    border-bottom: 2px solid #000;
  }

  .invoice-table th {
    background: #f0f0f0 !important;
    color: #000 !important;
    -webkit-print-color-adjust: exact;
  }

  .total-row.final {
    border-color: #000;
  }
}

/* Invoice Form Styles */
.invoice-form {
  background: var(--surface-color);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.time-entries-selection {
  margin: 1.5rem 0;
}

.time-entry-item {
  display: grid;
  grid-template-columns: auto 1fr auto auto auto;
  gap: 1rem;
  align-items: center;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  margin-bottom: 0.5rem;
}

.time-entry-item:hover {
  background: var(--background-color);
}

.time-entry-checkbox {
  margin: 0;
}

.time-entry-description {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.time-entry-hours {
  font-weight: 600;
  color: var(--primary-color);
}

.time-entry-rate {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.time-entry-amount {
  font-weight: 600;
  color: var(--success-color);
}

.invoice-summary {
  background: var(--background-color);
  padding: 1.5rem;
  border-radius: 6px;
  margin-top: 1rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.summary-row.total {
  font-weight: bold;
  font-size: 1.1rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

/* Logo Upload Styles */
.logo-upload-section {
  background: var(--surface-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.5rem;
  margin: 1rem 0;
}

.logo-upload-section h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.logo-description {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
}

.logo-preview-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.5rem;
  min-height: 120px;
  align-items: center;
}

.current-logo {
  position: relative;
  display: inline-block;
}

.logo-preview {
  max-width: 300px;
  max-height: 150px;
  border: 2px solid var(--border-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.remove-logo-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--danger-color);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.remove-logo-btn:hover {
  background: #c82333;
}

.no-logo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 200px;
  height: 120px;
  border: 2px dashed var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
}

.placeholder-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.logo-upload-controls {
  text-align: center;
}

.upload-logo-btn {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: background-color 0.2s;
}

.upload-logo-btn:hover {
  background: var(--primary-hover);
}

.upload-requirements {
  margin-top: 1rem;
  color: var(--text-secondary);
  font-size: 0.8rem;
  line-height: 1.4;
}

.upload-progress {
  margin-top: 1rem;
  text-align: center;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--background-color);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  width: 0%;
  transition: width 0.3s ease;
  animation: progress-animation 1.5s infinite;
}

@keyframes progress-animation {
  0% { width: 0%; }
  50% { width: 70%; }
  100% { width: 100%; }
}

.progress-text {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-error {
  margin-top: 1rem;
  padding: 12px;
  background: rgba(220, 53, 69, 0.1);
  border: 1px solid var(--danger-color);
  border-radius: 6px;
  color: var(--danger-color);
  font-size: 0.9rem;
}

.upload-success {
  background: var(--success-color) !important;
  color: white !important;
}

/* Invoice Settings Styles */
.invoice-settings-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
}

.invoice-settings-container h2 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.settings-description {
  color: var(--text-secondary);
  margin-bottom: 2rem;
  font-size: 1rem;
}

.invoice-settings-form {
  background: var(--surface-color);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.settings-section {
  padding: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.settings-section:last-child {
  border-bottom: none;
}

.settings-section h3 {
  color: var(--primary-color);
  margin: 0 0 1.5rem 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 1rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger-color);
}

.form-help {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.field-error {
  color: var(--danger-color);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.preview-section {
  background: var(--background-color);
  padding: 1rem;
  border-radius: 6px;
  margin-top: 1rem;
}

.preview-section label {
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.invoice-number-preview {
  font-family: 'Courier New', monospace;
  font-size: 1.1rem;
  font-weight: bold;
  color: var(--primary-color);
  background: white;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  margin-top: 0.5rem;
}

.form-actions {
  padding: 2rem;
  background: var(--background-color);
  border-top: 1px solid var(--border-color);
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--surface-color);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 0.75rem 1.5rem;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

.btn-secondary:hover {
  background: var(--background-color);
  border-color: var(--primary-color);
}

/* Responsive Invoice Styles */
@media (max-width: 768px) {
  .invoice-preview {
    padding: 1rem;
    font-size: 0.9rem;
  }

  .invoice-header {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .invoice-meta {
    text-align: center;
  }

  .invoice-details {
    grid-template-columns: 1fr;
  }

  .payment-info {
    grid-template-columns: 1fr;
  }

  .time-entry-item {
    grid-template-columns: 1fr;
    gap: 0.5rem;
  }

  .invoice-table {
    font-size: 0.8rem;
  }

  .logo-preview-container {
    min-height: 80px;
  }

  .logo-preview {
    max-width: 200px;
    max-height: 100px;
  }

  .no-logo-placeholder {
    width: 150px;
    height: 80px;
  }
}
