/* Finance.Web theme (Bootstrap 5 + custom layer)
   Goal: modern, clean dashboard-style UI with minimal markup changes. */

/* Light theme (default) */
:root {
  --fw-bg-0: #f3f4f6;
  --fw-bg-1: #e5e7eb;
  --fw-surface: #ffffff;
  --fw-surface-2: #e5e7eb;
  --fw-border: rgba(15, 23, 42, 0.08);
  --fw-text: #111827;
  --fw-muted: #6b7280;
  --fw-accent: #2563eb; /* blue */
  --fw-accent-2: #16a34a; /* green */
  --fw-danger: #b91c1c;
  --fw-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
}

/* Dark theme overrides */
:root[data-theme='dark'] {
  --fw-bg-0: #0b1020;
  --fw-bg-1: #0f172a;
  --fw-surface: rgba(15, 23, 42, 0.95);
  --fw-surface-2: rgba(15, 23, 42, 0.85);
  --fw-border: rgba(148, 163, 184, 0.35);
  --fw-text: rgba(241, 245, 249, 0.96);
  --fw-muted: rgba(148, 163, 184, 0.9);
  --fw-accent: #7c3aed; /* violet */
  --fw-accent-2: #22c55e; /* green */
  --fw-danger: #ef4444;
  --fw-shadow: 0 12px 30px rgba(0, 0, 0, 0.55);
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
}

@media (min-width: 768px) {
  html { font-size: 16px; }
}

body {
  margin: 0;
  color: var(--fw-text);
  background:
    radial-gradient(900px 420px at 15% -10%, rgba(124, 58, 237, 0.25), transparent 55%),
    radial-gradient(900px 420px at 85% 0%, rgba(34, 197, 94, 0.18), transparent 55%),
    linear-gradient(180deg, var(--fw-bg-0), var(--fw-bg-1));
}

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

/* Full-width inner container for navbar/footer */
.app-container-fluid {
  padding-left: 16px;
  padding-right: 16px;
}

/* Main body layout: sidebar + content */
.app-body {
  flex: 1;
  display: flex;
  align-items: stretch;
  padding-bottom: 60px; /* Footer height için boşluk */
}

.app-sidebar {
  width: 260px;
  background: var(--fw-surface);
  border-right: 1px solid var(--fw-border);
}

.app-sidebar-inner {
  padding: 14px 12px;
}

.app-content {
  flex: 1;
  padding: 8px 16px 40px;
}

/* Content is left-aligned (not centered) */
.app-content-inner {
  max-width: 1120px;
  margin-left: 0;
  margin-right: auto;
}

/* Auth gibi sidebar olmayan sayfalarda içeriği ortalamak için */
.app-content-inner-center {
  margin-left: auto;
  margin-right: auto;
}

/* Sidebar */
.app-sidebar .nav-link {
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--fw-muted);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0;
}

.app-sidebar .nav-link i {
  font-size: 1.05rem;
}

.app-sidebar .nav-link:hover {
  background: var(--fw-surface-2);
  color: var(--fw-text);
}

.app-sidebar .nav-link.active {
  background: color-mix(in srgb, var(--fw-accent) 14%, transparent);
  color: var(--fw-text);
}

/* Navbar */
.navbar.app-navbar {
  background: var(--fw-surface) !important;
  border-bottom: 1px solid var(--fw-border) !important;
  backdrop-filter: blur(14px);
}

.navbar.app-navbar .navbar-brand {
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--fw-text) !important;
}

.navbar.app-navbar .nav-link {
  color: var(--fw-text) !important;
  border-radius: 10px;
  padding: 8px 12px;
}

.navbar.app-navbar .nav-link:hover {
  background: var(--fw-surface-2);
}

.app-pill {
  border: 1px solid var(--fw-border);
  background: var(--fw-surface-2);
  color: var(--fw-text);
  border-radius: 12px;
}

.app-select {
  border: 1px solid var(--fw-border);
  background: var(--fw-surface-2);
  color: var(--fw-text);
  border-radius: 12px;
}

.app-select:focus {
  box-shadow: 0 0 0 0.25rem rgba(124, 58, 237, 0.25);
}

/* Cards */
.card.app-card {
  background: var(--fw-surface);
  border: 1px solid var(--fw-border);
  border-radius: 18px;
  box-shadow: var(--fw-shadow);
}

:root[data-theme='dark'] .card.app-card {
  background: rgba(15, 23, 42, 0.85);
}

.card.app-card .card-body {
  padding: 18px 18px;
}

.metric-label {
  color: var(--fw-muted);
  font-size: 0.9rem;
}

.metric-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.metric-value.positive { color: rgba(34, 197, 94, 0.92); }
.metric-value.negative { color: rgba(239, 68, 68, 0.92); }

/* Tables */
.table.app-table {
  color: var(--fw-text);
  border-color: var(--fw-border);
  --bs-table-bg: transparent;
  --bs-table-color: var(--fw-text);
  --bs-table-border-color: var(--fw-border);
  --bs-table-striped-bg: var(--fw-surface-2);
  --bs-table-striped-color: var(--fw-text);
  --bs-table-hover-bg: var(--fw-surface-2);
  --bs-table-hover-color: var(--fw-text);
}

.table.app-table thead th {
  color: var(--fw-muted);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.78rem;
  letter-spacing: 0.6px;
  border-bottom: 1px solid var(--fw-border);
  background: transparent;
}

.table.app-table tbody tr {
  background: var(--fw-surface);
}

.table.app-table tbody td {
  color: var(--fw-text);
  border-color: var(--fw-border);
  background: inherit;
}

.table.app-table tbody tr:hover {
  background: var(--fw-surface-2);
}

/* Dark mode table fixes */
:root[data-theme='dark'] .table.app-table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--fw-text);
}

:root[data-theme='dark'] .table.app-table tbody tr {
  background: rgba(30, 41, 59, 0.5);
}

:root[data-theme='dark'] .table.app-table tbody tr:hover {
  background: rgba(51, 65, 85, 0.6);
}

:root[data-theme='dark'] .table.app-table tbody td,
:root[data-theme='dark'] .table.app-table thead th {
  color: var(--fw-text);
  border-color: var(--fw-border);
}

/* Forms */
.form-control, .form-select {
  border-radius: 12px;
}

.form-control, .form-select {
  border: 1px solid var(--fw-border);
  background: var(--fw-surface-2);
  color: var(--fw-text);
}

.form-control::placeholder { color: var(--fw-muted); }

.form-control:focus, .form-select:focus, .btn:focus, .btn:active:focus {
  border-color: rgba(124, 58, 237, 0.5);
  box-shadow: 0 0 0 0.25rem rgba(124, 58, 237, 0.22);
}

/* Buttons */
.btn.app-primary {
  background: linear-gradient(135deg, var(--fw-accent), #4f46e5);
  border: 0;
  border-radius: 12px;
  box-shadow: 0 10px 22px rgba(124, 58, 237, 0.25);
}

.btn.app-primary:hover {
  filter: brightness(1.05);
}

.btn.app-outline {
  border-radius: 12px;
  border: 1px solid var(--fw-border);
  color: var(--fw-text);
  background: transparent;
}

.btn.app-outline:hover {
  background: var(--fw-surface-2);
}

/* Common helpers */
.app-muted { color: var(--fw-muted) !important; }

/* Theme-aware dropdown (replaces dropdown-menu-dark) */
.app-dropdown {
  --bs-dropdown-bg: var(--fw-surface);
  --bs-dropdown-border-color: var(--fw-border);
  --bs-dropdown-link-color: var(--fw-text);
  --bs-dropdown-link-hover-bg: var(--fw-surface-2);
  --bs-dropdown-link-hover-color: var(--fw-text);
  --bs-dropdown-link-active-bg: color-mix(in srgb, var(--fw-accent) 18%, transparent);
  --bs-dropdown-link-active-color: var(--fw-text);
  --bs-dropdown-divider-bg: var(--fw-border);

  background: var(--bs-dropdown-bg);
  border: 1px solid var(--bs-dropdown-border-color);
  box-shadow: var(--fw-shadow);
}

.app-dropdown .dropdown-item {
  color: var(--bs-dropdown-link-color);
  white-space: normal;
}

.app-dropdown .dropdown-item:hover,
.app-dropdown .dropdown-item:focus {
  color: var(--bs-dropdown-link-hover-color);
  background-color: var(--bs-dropdown-link-hover-bg);
}

/* Alerts */
.alert {
  border-radius: 16px;
  border: 1px solid var(--fw-border);
  background: var(--fw-surface);
  color: var(--fw-text);
}

.alert-danger {
  border-color: rgba(239, 68, 68, 0.35);
}

.alert-warning {
  border-color: rgba(245, 158, 11, 0.35);
}

/* Footer */
footer.app-footer {
  border-top: 1px solid var(--fw-border) !important;
  background: var(--fw-surface);
  backdrop-filter: blur(12px);
  padding: 14px 0;
  color: var(--fw-muted);
  flex-shrink: 0;
  min-height: 50px;
}

footer.app-footer a { color: var(--fw-accent); }
footer.app-footer a:hover { filter: brightness(0.9); }

/* Navbar icons & notifications */
.nav-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
}

.nav-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 0.65rem;
}

.dropdown-menu-invites {
  min-width: 260px;
}

/* Transaction Form Styles */
.transaction-type-selector .btn-group {
  border-radius: 16px;
  overflow: hidden;
  background: var(--fw-surface-2);
  padding: 4px;
}

.transaction-type-selector .type-btn {
  flex: 1;
  padding: 12px 24px;
  font-weight: 600;
  border: none;
  background: transparent;
  color: var(--fw-muted);
  transition: all 0.2s ease;
  border-radius: 12px;
}

.transaction-type-selector .type-btn:hover {
  color: var(--fw-text);
}

.transaction-type-selector .type-btn.selected.income-btn {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.transaction-type-selector .type-btn.selected.expense-btn {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Amount Card */
.amount-card {
  transition: all 0.3s ease;
}

.amount-card.income-type {
  border-color: rgba(34, 197, 94, 0.3);
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.05) 0%, var(--fw-surface) 100%);
}

.amount-card.expense-type {
  border-color: rgba(239, 68, 68, 0.3);
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.05) 0%, var(--fw-surface) 100%);
}

.amount-input-wrapper {
  max-width: 300px;
  margin: 0 auto;
}

.amount-input {
  font-size: 2.5rem !important;
  font-weight: 700;
  text-align: center;
  border: none !important;
  background: transparent !important;
  color: var(--fw-text);
  padding: 0 !important;
}

.amount-input:focus {
  box-shadow: none !important;
}

.income-type .amount-input {
  color: #22c55e;
}

.expense-type .amount-input {
  color: #ef4444;
}

/* Category Grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.category-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px;
  border-radius: 16px;
  background: var(--fw-surface);
  border: 2px solid var(--fw-border);
  cursor: pointer;
  transition: all 0.2s ease;
}

.category-item:hover {
  border-color: var(--fw-accent);
  transform: translateY(-2px);
}

.category-item.selected {
  border-color: var(--fw-accent);
  background: rgba(124, 58, 237, 0.08);
}

.category-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  margin-bottom: 8px;
}

.category-icon.income {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.category-icon.expense {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.category-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--fw-text);
  text-align: center;
  word-break: break-word;
}

/* Payment Method Selector */
.payment-method-selector {
  display: flex;
  gap: 12px;
}

.payment-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px;
  border-radius: 16px;
  background: var(--fw-surface);
  border: 2px solid var(--fw-border);
  color: var(--fw-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.payment-btn:hover {
  border-color: var(--fw-accent);
  color: var(--fw-text);
}

.payment-btn.selected {
  border-color: var(--fw-accent);
  background: rgba(124, 58, 237, 0.08);
  color: var(--fw-accent);
}

.payment-btn i {
  font-size: 1.5rem;
}

.payment-btn span {
  font-size: 0.85rem;
  font-weight: 500;
}