/* Cash Flow Tracker - shadcn-inspired styles (Black & White focused) */

:root {
  /* Brand Colors - Black & White focused */
  --brand-primary: #000000;
  --brand-accent: #40e0d0;
  --brand-black: #000000;
  --brand-white: #ffffff;
  --brand-gray: #dbdbdb;

  /* shadcn color tokens - Black & White */
  --background: #ffffff;
  --foreground: #000000;
  --card: #ffffff;
  --card-foreground: #000000;
  --popover: #ffffff;
  --popover-foreground: #000000;
  --primary: #000000;
  --primary-foreground: #ffffff;
  --secondary: #f5f5f5;
  --secondary-foreground: #000000;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #000000;
  --destructive: #000000;
  --destructive-foreground: #ffffff;
  --border: #dbdbdb;
  --input: #dbdbdb;
  --ring: #000000;
  --radius: 0.625rem;

  /* Transaction colors - keep for functional distinction */
  --incoming: #10b981;
  --incoming-bg: #ecfdf5;
  --outgoing: #f43f5e;
  --outgoing-bg: #fff1f2;
}

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

body {
  font-family: 'Gotham', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-weight: 500;
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Card component */
.card {
  background-color: var(--card);
  color: var(--card-foreground);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.card-header {
  padding: 1.5rem 1.5rem 0;
}

.card-title {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
}

.card-description {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-top: 0.5rem;
}

.card-content {
  padding: 1.5rem;
}

.card-footer {
  padding: 0 1.5rem 1.5rem;
}

/* Form elements */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.label {
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
}

.input {
  height: 2.5rem;
  width: 100%;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--input);
  background-color: transparent;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}

.input:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.1);
}

.input::placeholder {
  color: var(--muted-foreground);
}

.input:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* Button component */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  white-space: nowrap;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  height: 2.5rem;
  padding: 0.5rem 1rem;
  border: none;
  cursor: pointer;
  transition: background-color 0.15s, opacity 0.15s;
  outline: none;
}

.btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.15);
}

.btn:disabled {
  pointer-events: none;
  opacity: 0.5;
}

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

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

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

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

.btn-outline {
  background-color: var(--background);
  border: 1px solid var(--border);
  color: var(--foreground);
}

.btn-outline:hover {
  background-color: var(--accent);
}

.btn-destructive {
  background-color: var(--destructive);
  color: var(--destructive-foreground);
}

.btn-destructive:hover {
  background-color: #dc2626;
}

.btn-ghost {
  background-color: transparent;
  color: var(--foreground);
}

.btn-ghost:hover {
  background-color: var(--accent);
}

.btn-link {
  background-color: transparent;
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-lg {
  height: 2.75rem;
  padding: 0.5rem 1.5rem;
}

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

.btn-full {
  width: 100%;
}

/* Alert/Error message */
.alert {
  padding: 0.75rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-error {
  background-color: var(--outgoing-bg);
  color: var(--outgoing);
  border: 1px solid var(--outgoing);
}

.alert-success {
  background-color: var(--incoming-bg);
  color: var(--incoming);
  border: 1px solid var(--incoming);
}

/* Layout utilities */
.min-h-screen {
  min-height: 100vh;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.text-center {
  text-align: center;
}

.w-full {
  width: 100%;
}

.max-w-sm {
  max-width: 24rem;
}

.max-w-md {
  max-width: 28rem;
}

.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

.p-4 {
  padding: 1rem;
}

.p-6 {
  padding: 1.5rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.mt-4 {
  margin-top: 1rem;
}

.mb-4 {
  margin-bottom: 1rem;
}

.gap-2 {
  gap: 0.5rem;
}

.gap-4 {
  gap: 1rem;
}

/* Logo/Brand */
.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.brand-icon {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
}

.brand-logo svg {
  width: 2.5rem;
  height: 2.5rem;
  color: var(--foreground);
}

.brand-name {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--foreground);
}

.brand-name-dark {
  font-size: 1.5rem;
  font-weight: 600;
  color: #000000;
}

/* Links */
a {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  opacity: 0.7;
}

.text-muted {
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* Login page with background */
.login-page {
  background-color: #000000;
  background-image: url('../_assets/background2.jpg');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.login-page .brand-name {
  color: #ffffff;
}

.login-page .card {
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}

/* ============================================
   Dashboard Layout
   ============================================ */

.app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding-bottom: 6rem;
}

.app-header {
  background-color: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.app-header .brand-logo {
  margin-bottom: 0;
  justify-content: flex-start;
}

.app-header .brand-icon {
  width: 2rem;
  height: 2rem;
}

.app-header .brand-name-dark {
  font-size: 1.25rem;
}

.header-content {
  max-width: 100rem;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

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

.main-content {
  flex: 1;
  max-width: 100rem;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--foreground);
}

.page-subtitle {
  color: var(--muted-foreground);
  margin-top: 0.5rem;
}

/* ============================================
   Summary Cards
   ============================================ */

.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  .summary-cards {
    grid-template-columns: 1fr;
  }
}

.summary-card {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.summary-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted-foreground);
  text-transform: uppercase;
}

.summary-value {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.25rem;
}

.text-incoming {
  color: var(--incoming);
}

.text-outgoing {
  color: var(--outgoing);
}

.text-warning {
  color: var(--outgoing);
}

/* ============================================
   Toolbar & Filters
   ============================================ */

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

.filters-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  flex: 1;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  min-width: 200px;
  max-width: 300px;
}

.search-icon {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
  pointer-events: none;
}

.search-input {
  padding-left: 2.25rem;
}

.select-input {
  width: auto;
  min-width: 140px;
}

.date-input {
  width: auto;
  min-width: 140px;
}

.btn-icon {
  width: 1rem;
  height: 1rem;
  margin-right: 0.5rem;
}

/* ============================================
   Data Table
   ============================================ */

.table-container {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

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

.data-table th {
  padding: 0.75rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted-foreground);
  background-color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

.data-table tbody tr:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.transaction-row.no-attachments {
  background-color: var(--outgoing-bg);
}

.transaction-row.no-attachments:hover {
  background-color: rgba(244, 63, 94, 0.1);
}

.transaction-row.drag-over {
  background-color: var(--incoming-bg) !important;
  outline: 2px solid var(--incoming);
  outline-offset: -2px;
}

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

.text-center {
  text-align: center;
}

.reason-cell {
  max-width: 200px;
}

.reason-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   Badges
   ============================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.badge:hover {
  opacity: 0.8;
}

.badge-incoming {
  background-color: var(--incoming-bg);
  color: var(--incoming);
}

.badge-outgoing {
  background-color: var(--outgoing-bg);
  color: var(--outgoing);
}

/* ============================================
   Tags
   ============================================ */

.tag {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  border: 1px solid;
  cursor: grab;
  user-select: none;
}

.tag:active {
  cursor: grabbing;
}

.tag-remove,
.tag-remove-btn {
  margin-left: 0.25rem;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.875rem;
  line-height: 1;
  opacity: 0.7;
}

.tag-remove:hover,
.tag-remove-btn:hover {
  opacity: 1;
}

.tags-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  cursor: pointer;
}

/* Tag colors */
.tag-gray { background-color: #f3f4f6; color: #374151; border-color: #d1d5db; }
.tag-red { background-color: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.tag-orange { background-color: #ffedd5; color: #c2410c; border-color: #fdba74; }
.tag-amber { background-color: #fef3c7; color: #b45309; border-color: #fcd34d; }
.tag-yellow { background-color: #fef9c3; color: #a16207; border-color: #fde047; }
.tag-lime { background-color: #ecfccb; color: #4d7c0f; border-color: #bef264; }
.tag-green { background-color: #dcfce7; color: #15803d; border-color: #86efac; }
.tag-emerald { background-color: #d1fae5; color: #047857; border-color: #6ee7b7; }
.tag-teal { background-color: #ccfbf1; color: #0f766e; border-color: #5eead4; }
.tag-cyan { background-color: #cffafe; color: #0e7490; border-color: #67e8f9; }
.tag-sky { background-color: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.tag-blue { background-color: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.tag-indigo { background-color: #e0e7ff; color: #4338ca; border-color: #a5b4fc; }
.tag-violet { background-color: #ede9fe; color: #6d28d9; border-color: #c4b5fd; }
.tag-purple { background-color: #f3e8ff; color: #7e22ce; border-color: #d8b4fe; }
.tag-fuchsia { background-color: #fae8ff; color: #a21caf; border-color: #f0abfc; }
.tag-pink { background-color: #fce7f3; color: #be185d; border-color: #f9a8d4; }
.tag-rose { background-color: #ffe4e6; color: #be123c; border-color: #fda4af; }

/* ============================================
   Icon Buttons
   ============================================ */

.btn-icon-only {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  color: var(--muted-foreground);
  transition: background-color 0.15s, color 0.15s;
  position: relative;
}

.btn-icon-only:hover {
  background-color: var(--muted);
  color: var(--foreground);
}

.btn-icon-only svg {
  width: 1rem;
  height: 1rem;
}

.btn-icon-only.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-icon-only.btn-danger:hover {
  background-color: var(--outgoing-bg);
  color: var(--outgoing);
}

.attachment-count {
  position: absolute;
  top: -0.25rem;
  right: -0.25rem;
  background-color: var(--foreground);
  color: var(--background);
  font-size: 0.625rem;
  font-weight: 600;
  min-width: 1rem;
  height: 1rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ============================================
   Editable Cells
   ============================================ */

.editable-cell {
  cursor: pointer;
  padding: 0.125rem 0.25rem;
  border-radius: calc(var(--radius) - 4px);
  transition: background-color 0.15s;
}

.editable-cell:hover {
  background-color: var(--muted);
}

.font-medium {
  font-weight: 500;
}

.font-semibold {
  font-weight: 600;
}

.inline-edit-wrapper {
  background-color: var(--card);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  border-radius: var(--radius);
  padding: 0.25rem;
}

.inline-edit {
  min-width: 120px;
}

/* ============================================
   Tag Palette
   ============================================ */

.tag-palette {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--border);
  z-index: 50;
}

.tag-palette-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1.5rem 0;
  max-width: 100rem;
  margin: 0 auto;
}

.tag-palette-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.tag-palette-title svg {
  width: 1rem;
  height: 1rem;
  color: var(--muted-foreground);
}

.tag-palette-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-weight: 400;
}

.tag-palette-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  max-width: 100rem;
  margin: 0 auto;
  align-items: center;
}

.tag-item {
  display: flex;
  align-items: center;
  gap: 0.125rem;
}

.tag-color-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.5rem;
  height: 1.5rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  color: var(--muted-foreground);
}

.tag-color-btn:hover {
  background-color: var(--muted);
}

.tag-color-btn svg {
  width: 0.75rem;
  height: 0.75rem;
}

.tag-add-form {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.tag-add-form .input {
  height: 1.75rem;
  width: 8rem;
  font-size: 0.75rem;
}

.input-sm {
  height: 1.75rem;
  font-size: 0.75rem;
}

/* ============================================
   Dialogs
   ============================================ */

.dialog-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.dialog-overlay.active {
  display: flex;
}

.dialog {
  background-color: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 32rem;
  max-height: 90vh;
  overflow-y: auto;
}

.dialog-sm {
  max-width: 24rem;
}

.dialog-md {
  max-width: 40rem;
}

.dialog-xs {
  max-width: 18rem;
}

.dialog-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.dialog-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
}

.dialog-description {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-top: 0.25rem;
}

.dialog-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: calc(var(--radius) - 2px);
  cursor: pointer;
  font-size: 1.25rem;
  color: var(--muted-foreground);
}

.dialog-close:hover {
  background-color: var(--muted);
}

.dialog-content {
  padding: 1.5rem;
}

.dialog-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ============================================
   Form Elements (Extended)
   ============================================ */

.textarea {
  min-height: 5rem;
  resize: vertical;
}

.tags-input-wrapper {
  display: flex;
  gap: 0.5rem;
}

.tags-input-wrapper .input {
  flex: 1;
}

.form-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.current-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

/* ============================================
   Attachments
   ============================================ */

.attachments-list {
  margin-bottom: 1rem;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  background-color: var(--muted);
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 0.5rem;
}

.attachment-name {
  font-size: 0.875rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================
   History
   ============================================ */

.history-list {
  max-height: 24rem;
  overflow-y: auto;
}

.history-item {
  padding: 0.75rem;
  background-color: var(--muted);
  border-radius: calc(var(--radius) - 2px);
  margin-bottom: 0.75rem;
}

.history-item:last-child {
  margin-bottom: 0;
}

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

.history-field {
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

.history-date {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.history-changes {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
}

.history-old {
  background-color: var(--outgoing-bg);
  color: var(--outgoing);
  padding: 0.25rem 0.5rem;
  border-radius: calc(var(--radius) - 4px);
  text-decoration: line-through;
}

.history-new {
  background-color: var(--incoming-bg);
  color: var(--incoming);
  padding: 0.25rem 0.5rem;
  border-radius: calc(var(--radius) - 4px);
}

.history-arrow {
  color: var(--muted-foreground);
}

/* ============================================
   Color Picker
   ============================================ */

.color-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.25rem;
}

.color-swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: calc(var(--radius) - 4px);
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s;
}

.color-swatch:hover {
  transform: scale(1.1);
}

.color-swatch.selected {
  outline: 2px solid var(--foreground);
  outline-offset: 2px;
}

/* ============================================
   Empty State
   ============================================ */

.empty-state {
  background-color: var(--card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
}

.empty-title {
  color: var(--foreground);
  font-weight: 500;
}

.empty-subtitle {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* ============================================
   Hidden Utility
   ============================================ */

.hidden {
  display: none !important;
}

/* ============================================
   Settings Page
   ============================================ */

.settings-section {
  background-color: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
}

.accounts-list {
  min-height: 100px;
}

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

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