/*
 * Finances Application - Modern Design System & Component Styles
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&display=swap');

:root {
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --emerald-500: #10b981;
  --emerald-600: #059669;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;
}

body {
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Card Design System */
.app-card {
  background-color: #ffffff;
  border-radius: 1rem;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04), 0 1px 2px -1px rgba(0, 0, 0, 0.04);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.app-card-hover:hover {
  border-color: #e2e8f0;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.06), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
}

.app-stat-card {
  position: relative;
  overflow: hidden;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  background: #ffffff;
  border: 1px solid #f1f5f9;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease;
}

.app-stat-card:hover {
  border-color: #e2e8f0;
  box-shadow: 0 4px 12px 0 rgba(0, 0, 0, 0.05);
}

/* Universal HTML Button & Input Appearance Reset */
button,
input[type="button"],
input[type="reset"],
input[type="submit"] {
  font-family: inherit;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-sizing: border-box;
}

/* Universal Button Reset & Form Wrapper for Rails button_to */
form.button_to {
  display: inline-flex !important;
  align-items: center !important;
  vertical-align: middle !important;
  margin: 0 !important;
  padding: 0 !important;
}

form.button_to > button,
form.button_to > input[type="submit"] {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  font-weight: inherit;
  margin: 0;
  vertical-align: middle;
}

/* Base button styles applied to ALL button classes */
.btn,
.btn-primary,
.btn-secondary,
.btn-success,
.btn-warning,
.btn-danger,
.btn-ghost,
.btn-outline,
[class*="btn-"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  font-family: inherit;
  font-weight: 600;
  line-height: 1.25rem;
  border-radius: 0.75rem;
  padding: 0.5rem 1rem;
  font-size: 0.8125rem;
  border: 1px solid transparent;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
  user-select: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  box-sizing: border-box;
  text-align: center;
  transition: all 0.15s ease-in-out;
}

.btn:active,
[class*="btn-"]:active {
  transform: scale(0.98);
}

.btn:disabled,
[class*="btn-"]:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Size Variants */
.btn-xs,
[class*="btn-xs"] {
  padding: 0.25rem 0.625rem !important;
  font-size: 0.6875rem !important;
  line-height: 0.875rem !important;
  border-radius: 0.5rem !important;
}

.btn-sm,
[class*="btn-sm"] {
  padding: 0.375rem 0.75rem !important;
  font-size: 0.75rem !important;
  line-height: 1rem !important;
  border-radius: 0.5rem !important;
}

.btn-md,
[class*="btn-md"] {
  padding: 0.5rem 1.125rem !important;
  font-size: 0.8125rem !important;
  line-height: 1.25rem !important;
  border-radius: 0.75rem !important;
}

.btn-lg,
[class*="btn-lg"] {
  padding: 0.75rem 1.5rem !important;
  font-size: 0.9375rem !important;
  line-height: 1.375rem !important;
  border-radius: 0.875rem !important;
}

/* Table & Card Micro-Action Buttons */
.action-link,
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  padding: 0.25rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
  text-decoration: none;
  border: 1px solid transparent;
  background-color: transparent;
  cursor: pointer;
  white-space: nowrap;
  vertical-align: middle;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  transition: all 0.15s ease-in-out;
  user-select: none;
}

.action-link:hover,
.action-btn:hover {
  text-decoration: none;
}

.action-link-default {
  color: #475569;
}
.action-link-default:hover {
  color: #0f172a;
  background-color: #f1f5f9;
}

.action-link-primary {
  color: #4f46e5;
  background-color: #eef2ff;
  border-color: #e0e7ff;
}
.action-link-primary:hover {
  color: #3730a3;
  background-color: #e0e7ff;
}

.action-link-success {
  color: #047857;
  background-color: #ecfdf5;
  border-color: #d1fae5;
}
.action-link-success:hover {
  color: #065f46;
  background-color: #a7f3d0;
}

.action-link-warning {
  color: #b45309;
  background-color: #fffbeb;
  border-color: #fef3c7;
}
.action-link-warning:hover {
  color: #92400e;
  background-color: #fde68a;
}

.action-link-danger {
  color: #e11d48;
}
.action-link-danger:hover {
  color: #be123c;
  background-color: #fff1f2;
}

/* Hamburger Action Menu System */
.action-menu-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 2rem !important;
  height: 2rem !important;
  padding: 0 !important;
  margin: 0 !important;
  border-radius: 0.625rem !important;
  color: #64748b !important;
  background-color: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03) !important;
  cursor: pointer !important;
  vertical-align: middle !important;
  transition: all 0.15s ease-in-out !important;
}

.action-menu-btn:hover {
  color: #0f172a !important;
  background-color: #f8fafc !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.05) !important;
}

.action-menu-btn:active {
  transform: scale(0.95);
}

.action-menu-dropdown {
  position: fixed;
  top: 0;
  left: 0;
  width: 11.5rem;
  background-color: #ffffff;
  border-radius: 0.875rem;
  border: 1px solid #e2e8f0;
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.14), 0 8px 10px -6px rgba(15, 23, 42, 0.08);
  padding: 0.375rem;
  text-align: left;
  z-index: 9999;
}

.action-menu-dropdown.hidden {
  display: none !important;
}

.action-menu-dropdown form.button_to {
  display: flex !important;
  width: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
}

.action-menu-item,
.action-menu-dropdown form.button_to > button.action-menu-item {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 0.625rem !important;
  width: 100% !important;
  padding: 0.5rem 0.625rem !important;
  margin: 0 !important;
  border-radius: 0.5rem !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
  line-height: 1rem !important;
  color: #334155;
  background-color: transparent;
  border: 0 !important;
  text-decoration: none !important;
  cursor: pointer !important;
  text-align: left !important;
  white-space: nowrap !important;
  transition: all 0.12s ease-in-out;
}

.action-menu-item:hover,
.action-menu-dropdown form.button_to > button.action-menu-item:hover {
  background-color: #f1f5f9;
  color: #0f172a;
  text-decoration: none !important;
}

.action-menu-item svg {
  width: 1rem !important;
  height: 1rem !important;
  flex-shrink: 0 !important;
  display: block !important;
  opacity: 0.85;
}

.action-menu-item-success,
.action-menu-dropdown form.button_to > button.action-menu-item-success {
  color: #047857 !important;
}
.action-menu-item-success:hover,
.action-menu-dropdown form.button_to > button.action-menu-item-success:hover {
  background-color: #ecfdf5 !important;
  color: #065f46 !important;
}

.action-menu-item-warning,
.action-menu-dropdown form.button_to > button.action-menu-item-warning {
  color: #b45309 !important;
}
.action-menu-item-warning:hover,
.action-menu-dropdown form.button_to > button.action-menu-item-warning:hover {
  background-color: #fffbeb !important;
  color: #92400e !important;
}

.action-menu-item-danger,
.action-menu-dropdown form.button_to > button.action-menu-item-danger {
  color: #e11d48 !important;
}
.action-menu-item-danger:hover,
.action-menu-dropdown form.button_to > button.action-menu-item-danger:hover {
  background-color: #fff1f2 !important;
  color: #be123c !important;
}

.action-menu-divider {
  height: 1px;
  background-color: #f1f5f9;
  margin: 0.25rem 0;
}

/* Primary Button (Indigo Gradient) */
.btn-primary {
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 1px 3px 0 rgba(79, 70, 229, 0.3) !important;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #4338ca 0%, #3730a3 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.4) !important;
}

/* Success Button (Emerald Gradient) */
.btn-success {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 1px 3px 0 rgba(5, 150, 105, 0.3) !important;
}
.btn-success:hover {
  background: linear-gradient(135deg, #047857 0%, #065f46 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 6px -1px rgba(5, 150, 105, 0.4) !important;
}

/* Warning Button (Amber Gradient) */
.btn-warning {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 1px 3px 0 rgba(217, 119, 6, 0.3) !important;
}
.btn-warning:hover {
  background: linear-gradient(135deg, #b45309 0%, #92400e 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 6px -1px rgba(217, 119, 6, 0.4) !important;
}

/* Danger Button (Rose Gradient) */
.btn-danger {
  background: linear-gradient(135deg, #e11d48 0%, #be123c 100%) !important;
  color: #ffffff !important;
  border-color: transparent !important;
  box-shadow: 0 1px 3px 0 rgba(225, 29, 72, 0.3) !important;
}
.btn-danger:hover {
  background: linear-gradient(135deg, #be123c 0%, #9f1239 100%) !important;
  color: #ffffff !important;
  box-shadow: 0 4px 6px -1px rgba(225, 29, 72, 0.4) !important;
}

/* Secondary Button (Crisp White with Slate Border) */
.btn-secondary {
  background-color: #ffffff !important;
  color: #334155 !important;
  border-color: #cbd5e1 !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}
.btn-secondary:hover {
  background-color: #f8fafc !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

/* Ghost Button (Transparent with Hover) */
.btn-ghost {
  background-color: transparent !important;
  color: #64748b !important;
  border-color: transparent !important;
}
.btn-ghost:hover {
  background-color: #f1f5f9 !important;
  color: #0f172a !important;
}

/* Outline Button */
.btn-outline {
  background-color: transparent !important;
  color: #4f46e5 !important;
  border-color: #c7d2fe !important;
}
.btn-outline:hover {
  background-color: #eef2ff !important;
  border-color: #a5b4fc !important;
  color: #4338ca !important;
}

/* Badge Design System */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1rem;
}

.badge-success {
  background-color: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}

.badge-warning {
  background-color: #fffbeb;
  color: #b45309;
  border: 1px solid #fde68a;
}

.badge-danger {
  background-color: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.badge-info {
  background-color: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

.badge-purple {
  background-color: #f5f3ff;
  color: #6d28d9;
  border: 1px solid #ddd6fe;
}

.badge-neutral {
  background-color: #f8fafc;
  color: #475569;
  border: 1px solid #e2e8f0;
}

/* Form Controls */
.form-input-custom,
.form-select-custom {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  color: #1e293b;
  background-color: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 0.75rem;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.03);
  box-sizing: border-box;
  transition: all 0.15s ease-in-out;
}

.form-input-custom:focus,
.form-select-custom:focus {
  outline: none;
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

/* Standardized Table */
.app-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}

.app-table thead th {
  background-color: #f8fafc;
  color: #64748b;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  vertical-align: middle;
}

.app-table tbody td {
  padding: 1rem 1.25rem;
  font-size: 0.875rem;
  color: #334155;
  border-bottom: 1px solid #f1f5f9;
  text-align: left;
  vertical-align: middle;
}

.app-table thead th.text-right,
.app-table tbody td.text-right {
  text-align: right !important;
}

.app-table thead th.text-center,
.app-table tbody td.text-center {
  text-align: center !important;
}

.app-table tbody tr:hover td {
  background-color: #f8fafc;
}

/* Credit Card Realistic UI */
.credit-card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 1.586 / 1;
  border-radius: 1.25rem;
  padding: 1.5rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25), 0 8px 10px -6px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.credit-card-chip {
  width: 38px;
  height: 28px;
  background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e1 50%, #94a3b8 100%);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  position: relative;
}
