/*!
 * Unity Money Manager - Modern Smooth Enhancement Layer
 * Loads AFTER norma-theme.css and bootstrap-override.css
 * Adds glassmorphism, motion, focus rings, and refined interaction.
 * Keeps the existing Norma C.O.R.E. color palette.
 */

/* ---------- Ambient background ---------- */
body {
  background:
    radial-gradient(ellipse at 0% 0%, rgba(255,193,7,0.035) 0%, transparent 35%),
    radial-gradient(ellipse at 100% 100%, rgba(105,240,174,0.02) 0%, transparent 35%),
    radial-gradient(ellipse at 80% 20%, rgba(68,138,255,0.015) 0%, transparent 30%),
    var(--void) !important;
  background-attachment: fixed;
}

/* ---------- Motion defaults ---------- */
.card, .stat-card, .btn, .form-control, .sidebar-nav a, .dropdown-toggle, .dropdown-menu, .login-card, .table tbody tr {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Page transitions ---------- */
#main-content {
  animation: fadeInUp 0.35s ease-out;
}

.login-card {
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Glassmorphism top bar ---------- */
.navbar-top {
  background: rgba(17,17,17,0.72) !important;
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom-color: rgba(255,255,255,0.06) !important;
  box-shadow: 0 4px 30px rgba(0,0,0,0.35);
}

/* ---------- Sidebar polish ---------- */
.sidebar {
  background: rgba(17,17,17,0.92) !important;
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-right-color: rgba(255,255,255,0.06) !important;
}

.sidebar-brand {
  box-shadow: 0 0 24px rgba(255,193,7,0.12);
}

.sidebar-nav a {
  border-radius: 10px;
  margin: 2px 0;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.06) !important;
  color: #fff !important;
  transform: translateX(3px);
}

.sidebar-nav a.active {
  background: rgba(255,193,7,0.12) !important;
  color: var(--amber) !important;
  box-shadow: inset 0 0 18px rgba(255,193,7,0.04);
}

.sidebar-nav a i {
  transition: transform 0.2s;
}

.sidebar-nav a:hover i {
  transform: scale(1.1);
}

/* ---------- Focus visible rings ---------- */
a:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.dropdown-toggle:focus-visible,
.sidebar-nav a:focus-visible,
.table-footer a:focus-visible,
.sidebar-toggle:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
  border-radius: 4px;
}

.form-control:focus-visible {
  outline-offset: -2px;
}

/* ---------- Buttons ---------- */
.btn {
  transform: translateY(0);
  will-change: transform;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0) scale(0.98);
}

.btn-primary:hover {
  box-shadow: 0 0 24px rgba(255,193,7,0.25);
}

.btn-success:hover {
  box-shadow: 0 0 24px rgba(105,240,174,0.25);
}

.btn-danger:hover {
  box-shadow: 0 0 24px rgba(255,82,82,0.25);
}

.btn-secondary:hover {
  border-color: rgba(255,255,255,0.2) !important;
  background: rgba(255,255,255,0.06) !important;
}

/* Buttons that are also icons (e.g. action icons) must keep FontAwesome font */
.btn.fa, .btn[class*="fa-"] {
  font-family: FontAwesome !important;
}

.btn.fa::before, .btn[class*="fa-"]::before {
  position: relative;
  z-index: 1;
}

/* Make action icon buttons a sensible size */
.btn.btn-xs {
  padding: 6px 10px;
  font-size: 0.75rem;
  line-height: 1;
}
.card {
  background: rgba(22,22,22,0.85) !important;
  border-color: rgba(255,255,255,0.07) !important;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.2s;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,193,7,0.05);
  border-color: rgba(255,255,255,0.12) !important;
}

.card.panel-danger:hover {
  border-color: rgba(255,82,82,0.3) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,82,82,0.06);
}

.card.panel-primary:hover {
  border-color: rgba(255,193,7,0.3) !important;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,193,7,0.06);
}

.card-header {
  background: transparent !important;
}

.card-header h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ---------- Stat cards ---------- */
.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
}

.stat-card .stat-icon {
  transition: transform 0.2s, box-shadow 0.2s;
}

.stat-card:hover .stat-icon {
  transform: scale(1.08);
}

/* ---------- Transaction page tint ---------- */
.card.panel-danger {
  background: linear-gradient(180deg, rgba(22,22,22,0.92) 0%, rgba(255,82,82,0.04) 100%) !important;
  border-top: 4px solid var(--danger) !important;
}

.card.panel-primary {
  background: linear-gradient(180deg, rgba(22,22,22,0.92) 0%, rgba(255,193,7,0.04) 100%) !important;
  border-top: 4px solid var(--amber) !important;
}

/* ---------- Tables ---------- */
.table tbody tr:hover {
  background: rgba(255,255,255,0.045) !important;
}

/* ---------- Forms ---------- */
.form-control:hover {
  border-color: rgba(255,255,255,0.15) !important;
}

/* Hide custom arrow and restore native select arrow to avoid repeated triangle glitch */
select.form-control {
  background-image: none !important;
  -webkit-appearance: auto !important;
  -moz-appearance: auto !important;
  appearance: auto !important;
  padding-right: var(--space-4) !important;
}

/* ---------- Input groups ---------- */
.input-group:hover .input-group-addon {
  border-color: rgba(255,255,255,0.15) !important;
  color: var(--text-secondary) !important;
}

/* ---------- Dropdowns ---------- */
.dropdown.open .dropdown-menu {
  transform-origin: top right;
  animation: dropdownIn 0.2s ease;
}

@keyframes dropdownIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

/* ---------- Progress bars ---------- */
.progress-bar {
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---------- Alerts ---------- */
.alert {
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

/* ---------- Mobile sidebar toggle ---------- */
.sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.sidebar-toggle:hover {
  background: rgba(255,255,255,0.1);
  border-color: rgba(255,255,255,0.15);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px);
  z-index: 99;
}

@media (max-width: 768px) {
  .sidebar-toggle {
    display: inline-flex;
  }

  .sidebar.open ~ .sidebar-overlay,
  .sidebar-overlay.active {
    display: block;
  }
}

/* ---------- Utilities ---------- */
.glow-amber { box-shadow: 0 0 24px rgba(255,193,7,0.15); }
.glow-danger { box-shadow: 0 0 24px rgba(255,82,82,0.15); }
.glow-success { box-shadow: 0 0 24px rgba(105,240,174,0.15); }

.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .card, .stat-card, .btn, .form-control, .sidebar-nav a, .dropdown-menu, .login-card, #main-content,
  .table tbody tr, .progress-bar, .alert {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
