/* Time Tracker Styles — Dark Theme */

.time-tracker-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Screen Management */
.screen {
  display: none;
}

.screen.active {
  display: block;
}

.section {
  display: none;
}

.section.active {
  display: block;
}

/* Authentication Screen */
.auth-container {
  max-width: 450px;
  margin: 4rem auto;
  padding: 2rem;
  background: var(--surface, #151311);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 8px;
}

.auth-container h1 {
  text-align: center;
  margin-bottom: 0.5rem;
  color: var(--text, #f5f0ea);
}

.auth-container .subtitle {
  text-align: center;
  color: var(--text-muted, #a8a19a);
  margin-bottom: 2rem;
}

.auth-form {
  display: none;
}

.auth-form.active {
  display: block;
}

.auth-form h2 {
  margin-bottom: 1.5rem;
  color: var(--text, #f5f0ea);
}

.switch-auth {
  text-align: center;
  margin-top: 1.5rem;
  color: var(--text-muted, #a8a19a);
}

.switch-auth a {
  color: var(--red, #e63227);
  text-decoration: none;
}

.switch-auth a:hover {
  text-decoration: underline;
}

/* Form Styles */
.form-group {
  margin-bottom: 1.5rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text, #f5f0ea);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 4px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text, #f5f0ea);
  transition: border-color 0.2s;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--red, #e63227);
}

.form-group small {
  display: block;
  margin-top: 0.25rem;
  color: var(--text-muted, #a8a19a);
  font-size: 0.875rem;
}

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

/* Button Styles */
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background: var(--red, #e63227);
  color: #fff;
}

.btn-primary:hover {
  background: #c42a20;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text, #f5f0ea);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: var(--text-muted, #a8a19a);
}

.btn-danger {
  background: rgba(220, 53, 69, 0.15);
  color: #dc3545;
  border: 1px solid rgba(220, 53, 69, 0.3);
}

.btn-danger:hover {
  background: rgba(220, 53, 69, 0.25);
}

.btn-success {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.btn-success:hover {
  background: rgba(34, 197, 94, 0.25);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* App Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border, rgba(168, 161, 154, 0.15));
}

.app-header h1 {
  margin: 0;
  color: var(--text, #f5f0ea);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.user-info span {
  color: var(--text-muted, #a8a19a);
}

/* Section Header */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  margin: 0;
  color: var(--text, #f5f0ea);
}

/* Projects List */
.projects-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--surface, #151311);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 8px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.project-card:hover {
  border-color: var(--red, #e63227);
}

.project-info h3 {
  margin: 0 0 0.5rem 0;
  color: var(--text, #f5f0ea);
}

.project-rate {
  color: var(--text-muted, #a8a19a);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.project-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 6px;
  margin-top: 1rem;
}

.stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stat-label {
  font-size: 0.875rem;
  color: var(--text-muted, #a8a19a);
}

.stat-value {
  font-weight: 600;
  color: var(--text, #f5f0ea);
}

.stat-amount {
  color: #22c55e;
}

.project-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Summary Box */
.summary-box {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 8px;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.summary-label {
  font-size: 0.875rem;
  color: var(--text-muted, #a8a19a);
  font-weight: 500;
}

.summary-value {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text, #f5f0ea);
}

.timer-card {
  background: var(--surface, #151311);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.timer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.timer-header h3 {
  margin: 0;
  color: var(--text, #f5f0ea);
}

.timer-subtitle {
  margin: 0.25rem 0 0;
  color: var(--text-muted, #a8a19a);
  font-size: 0.95rem;
}

.timer-display {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--red, #e63227);
}

.timer-project-label {
  color: var(--text-muted, #a8a19a);
  margin: 0.25rem 0 1rem;
  font-size: 0.95rem;
}

.timer-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
}

/* Entries List */
.entries-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.entry-card {
  background: var(--surface, #151311);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 8px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.entry-card:hover {
  border-color: var(--red, #e63227);
}

.entry-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.entry-date {
  font-weight: 600;
  color: var(--text, #f5f0ea);
}

.entry-time {
  color: var(--red, #e63227);
  font-weight: 500;
}

.entry-amount {
  color: #22c55e;
  font-weight: 600;
  margin-left: auto;
}

.entry-notes {
  color: var(--text-muted, #a8a19a);
  margin-bottom: 1rem;
  white-space: pre-wrap;
}

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

/* Empty State */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted, #a8a19a);
  font-size: 1.125rem;
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--surface, #151311);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 8px;
  padding: 0;
  max-width: 500px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.4);
}

.modal-wide {
  max-width: 700px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border, rgba(168, 161, 154, 0.15));
}

.modal-header h3 {
  margin: 0;
  color: var(--text, #f5f0ea);
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted, #a8a19a);
  cursor: pointer;
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background 0.2s;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.06);
}

.modal-content form {
  padding: 1.5rem;
}

.modal-actions {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

/* Error / Info / Success Messages */
.error-message,
.info-message,
.success-message {
  font-size: 0.875rem;
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 4px;
  border: 1px solid transparent;
  display: none;
}

.error-message {
  color: #fca5a5;
  background: rgba(220, 53, 69, 0.15);
  border-color: rgba(220, 53, 69, 0.3);
}

.info-message {
  color: #93c5fd;
  background: rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.3);
}

.success-message {
  color: #86efac;
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
}

.error-message:not(:empty),
.info-message:not(:empty),
.success-message:not(:empty),
.error-message.is-visible,
.info-message.is-visible,
.success-message.is-visible {
  display: block;
}

/* Logo Preview */
.logo-preview {
  margin-top: 1rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 8px;
  text-align: center;
  display: none;
}

.logo-preview:not(:empty) {
  display: block;
}

.logo-preview img {
  max-width: 200px;
  max-height: 200px;
  object-fit: contain;
}

/* Header Buttons */
.header-buttons {
  display: flex;
  gap: 0.5rem;
}

/* Import Modal */
.import-info {
  background: rgba(251, 191, 36, 0.1);
  border: 1px solid rgba(251, 191, 36, 0.3);
  border-radius: 6px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.import-info p {
  margin: 0.5rem 0;
  color: #fbbf24;
  font-size: 0.9rem;
}

.import-info p:first-child {
  margin-top: 0;
}

.import-info p:last-child {
  margin-bottom: 0;
}

/* Invoice Styles */
.modal-invoice {
  max-width: 900px;
}

.modal-header .invoice-actions {
  display: flex;
  gap: 1rem;
  align-items: center;
}

/* Invoice content stays light — it's a document preview */
.invoice-content {
  padding: 1.5rem;
  background: white;
  border-radius: 0 0 8px 8px;
}

.invoice-page {
  max-width: 960px;
  margin: 0 auto;
  font-family: system-ui, -apple-system, sans-serif;
  color: #111827;
  position: relative;
  overflow: hidden;
}

.invoice-top {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  margin-bottom: 1.5rem;
}

.invoice-branding {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
}

.invoice-logo img {
  max-width: 140px;
  max-height: 70px;
  object-fit: contain;
}

.invoice-from h2 {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
}

.invoice-from p {
  margin: 0.15rem 0;
  color: #4b5563;
}

.invoice-meta {
  text-align: right;
}

.invoice-meta h1 {
  margin: 0 0 0.5rem;
  letter-spacing: 0.18em;
  font-size: 1.75rem;
  text-transform: uppercase;
}

.invoice-meta-list {
  margin: 0;
  padding: 0;
}

.invoice-meta-list .meta-row {
  display: flex;
  gap: 1rem;
  justify-content: space-between;
  margin: 0.25rem 0;
}

.invoice-meta-list .meta-label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #6b7280;
}

.invoice-meta-list .meta-value {
  font-weight: 600;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.invoice-info-grid {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.invoice-to h3 {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
}

.invoice-to p {
  margin: 0.2rem 0;
  color: #4b5563;
}

.invoice-summary-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  min-width: 260px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.summary-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
  font-weight: 600;
  color: #111827;
  font-variant-numeric: tabular-nums;
}

.summary-line.total {
  padding-top: 0.75rem;
  margin-top: 0.75rem;
  border-top: 1px solid #e5e7eb;
  font-size: 1.15rem;
}

.summary-help {
  margin: 0;
  color: #6b7280;
  font-size: 0.95rem;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.invoice-table thead {
  background: #f4f6fb;
}

.invoice-table th,
.invoice-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid #e5e7eb;
}

.invoice-table th {
  font-weight: 600;
  color: #1f2933;
  text-transform: uppercase;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}

.invoice-table td {
  color: #374151;
}

.invoice-table .numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.invoice-table .date-col {
  width: 120px;
}

.invoice-table tbody tr:hover {
  background: #f9fafb;
}

.invoice-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: #6b7280;
  font-style: italic;
}

.invoice-footer {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid #e5e7eb;
  color: #6b7280;
  font-size: 0.95rem;
}

/* Responsive Design */
@media (max-width: 768px) {
  .time-tracker-container {
    padding: 1rem 0.5rem;
  }

  .auth-container {
    margin: 2rem auto;
    padding: 1.5rem;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .projects-list {
    grid-template-columns: 1fr;
  }

  .summary-box {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .entry-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .entry-amount {
    margin-left: 0;
  }

  .project-actions {
    flex-direction: column;
  }

  .project-actions .btn {
    width: 100%;
  }

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

  .modal-content {
    width: 95%;
  }

  .invoice-top,
  .invoice-info-grid {
    flex-direction: column;
    align-items: flex-start;
  }

  .invoice-meta {
    text-align: left;
  }

  .invoice-summary-card {
    width: 100%;
    min-width: unset;
  }
}

/* Invoice History */
.invoice-history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.invoice-history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(168, 161, 154, 0.15));
  border-radius: 8px;
}

.invoice-history-info {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.invoice-history-info .invoice-number {
  font-weight: 600;
  color: var(--text, #f5f0ea);
}

.invoice-history-info .invoice-date {
  color: var(--text-muted, #a8a19a);
}

.invoice-history-info .invoice-amount {
  font-weight: 600;
  color: #22c55e;
}

.invoice-history-info .invoice-status {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.invoice-status.status-billed {
  background: rgba(251, 191, 36, 0.15);
  color: #fbbf24;
}

.invoice-status.status-paid {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

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

/* Invoice Paid Banner */
.invoice-paid-banner {
  position: absolute;
  top: 40px;
  right: -35px;
  background: #059669;
  color: white;
  padding: 0.5rem 3rem;
  font-weight: 700;
  font-size: 0.9rem;
  transform: rotate(45deg);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Print Styles */
@media print {
  .app-header,
  .section-header,
  .project-actions,
  .entry-actions,
  .btn,
  .modal {
    display: none !important;
  }

  .entry-card,
  .project-card {
    break-inside: avoid;
    page-break-inside: avoid;
  }
}
