/* Personal Multi-Company Financial Tracker Modern Styling & Design System */

:root {
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bg-main: #f8fafc;
  --bg-card: #ffffff;
  --border-color: #d9dee8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --income-green: #10b981;
  --expense-red: #ef4444;
  --warning-amber: #f59e0b;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}

/* ==================================================
   GLOBAL UNIFIED FORM INPUT & SELECT DESIGN SYSTEM
   ================================================== */

input[type="text"],
input[type="number"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="url"],
input[type="tel"],
textarea,
.form-input,
.form-textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-sans);
  font-size: 0.875rem; /* 14px */
  line-height: 1.375rem;
  color: #0f172a;
  background-color: #ffffff;
  border: 1px solid #d9dee8;
  border-radius: 0.75rem; /* 12px */
  padding: 0.625rem 0.875rem; /* ~44px total height */
  height: 2.75rem; /* 44px height */
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  outline: none !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

textarea,
.form-textarea {
  height: auto;
  min-height: 100px;
  resize: vertical;
}

/* GLOBAL UNIFIED SELECT / DROPDOWN STYLING */
select,
.form-select {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-sans);
  font-size: 0.875rem !important; /* 14px */
  line-height: 1.375rem !important;
  color: #0f172a !important;
  background-color: #ffffff !important;
  border: 1px solid #d9dee8 !important;
  border-radius: 0.75rem !important; /* 12px rounded-xl */
  padding: 0.625rem 2.5rem 0.625rem 0.875rem !important; /* 44px total height with room for arrow */
  height: 2.75rem !important; /* 44px height matching inputs exactly */
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  outline: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3e%3cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3e%3c/svg%3e") !important;
  background-position: right 0.875rem center !important;
  background-repeat: no-repeat !important;
  background-size: 1.125rem 1.125rem !important;
  cursor: pointer;
}

/* UNIVERSAL FOCUS STATE - NO BLACK OUTLINES ANYWHERE */
input:focus,
select:focus,
textarea:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none !important;
  outline-offset: 0 !important;
  border-color: #6366f1 !important; /* Brand indigo */
  box-shadow: 0 0 0 3.5px rgba(99, 102, 241, 0.15) !important;
}

/* Module-specific focus ring overlays */
.focus-emerald:focus,
.focus-emerald:focus-visible {
  border-color: #10b981 !important;
  box-shadow: 0 0 0 3.5px rgba(16, 185, 129, 0.15) !important;
}

.focus-rose:focus,
.focus-rose:focus-visible {
  border-color: #f43f5e !important;
  box-shadow: 0 0 0 3.5px rgba(244, 63, 94, 0.15) !important;
}

/* Hover state */
input:hover:not(:focus):not(:disabled),
select:hover:not(:focus):not(:disabled),
textarea:hover:not(:focus):not(:disabled) {
  border-color: #cbd5e1 !important;
}

/* Placeholders & Unselected Option */
input::placeholder,
textarea::placeholder {
  color: #94a3b8;
  opacity: 1;
}

select:invalid,
select option[value=""] {
  color: #94a3b8;
}

select option:not([value=""]) {
  color: #0f172a;
}

/* Disabled state */
input:disabled,
select:disabled,
textarea:disabled {
  background-color: #f1f5f9 !important;
  color: #64748b !important;
  cursor: not-allowed;
  border-color: #e2e8f0 !important;
}

/* Form Label & Asterisk */
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  margin-bottom: 0.375rem; /* 6px */
}

.form-required {
  color: #ef4444;
  margin-left: 0.125rem;
  font-weight: 500;
}

/* Validation Error Styles */
.form-input-error {
  border-color: #f87171 !important;
}
.form-input-error:focus {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3.5px rgba(239, 68, 68, 0.15) !important;
}
.form-error-msg {
  font-size: 0.75rem;
  color: #dc2626;
  margin-top: 0.25rem;
}

/* Health Badge Styles */
.badge-healthy {
  background-color: #d1fae5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.badge-warning {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}
.badge-risk {
  background-color: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Modal Overlay */
.modal-backdrop {
  background-color: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
  animation: fadeIn 0.25s ease-out forwards;
}

/* Print Rules */
@media print {
  .no-print { display: none !important; }
  body { background: white; color: black; }
  .card { border: none !important; box-shadow: none !important; }
}
