/* ==========================================================================
   RESPONSIVE & MOBILE-FIRST OPTIMIZATIONS - FinanSeo Dashboard
   ========================================================================== */

/* Mobile Bottom Navigation */
.mobile-bottom-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--mobile-nav-height);
  background: rgba(9, 13, 22, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  z-index: 900;
  padding: 0 0.5rem;
  justify-content: space-around;
  align-items: center;
}

.mobile-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.3rem 0.4rem;
  transition: all var(--transition-fast);
}

.mobile-nav-item svg {
  width: 18px;
  height: 18px;
}

.mobile-nav-item.active {
  color: var(--primary);
}

.mobile-nav-item:active {
  transform: scale(0.95);
}

/* Floating Action Button (FAB) */
.mobile-fab {
  position: fixed;
  bottom: 4.85rem;
  right: 1rem;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), #10b981);
  color: #ffffff;
  border: none;
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 850;
  transition: transform var(--transition-fast);
}

.mobile-fab:active {
  transform: scale(0.95);
}

.mobile-fab svg {
  width: 24px;
  height: 24px;
}

/* Mobile Expense Cards */
.mobile-expense-cards {
  display: none;
  flex-direction: column;
  gap: 0.75rem;
}

.mobile-expense-card {
  padding: 0.875rem 1rem;
  background: var(--bg-card-solid);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.mobile-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.mobile-card-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.8rem;
}

/* Tablet & Mobile Media Queries */
@media (max-width: 1080px) {
  .charts-section {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --header-height: 3.5rem;
  }

  .mobile-bottom-nav {
    display: flex;
  }

  .mobile-fab {
    display: flex;
  }

  .dashboard-view {
    padding-bottom: 5.5rem;
  }

  .dashboard-main {
    padding: 1rem 0.75rem;
    gap: 1rem;
  }

  /* Header Responsive Fix */
  .dashboard-header {
    min-height: 3.5rem;
    padding: 0;
  }

  .header-container {
    padding: 0.35rem 0.75rem;
    gap: 0.4rem;
  }

  .header-brand .brand-title {
    font-size: 1.15rem;
  }

  .header-brand .brand-icon-wrapper {
    width: 32px;
    height: 32px;
  }

  .header-period-selector {
    padding: 0.2rem 0.4rem;
    gap: 0.2rem;
  }

  .header-period-label {
    min-width: 80px;
    font-size: 0.75rem;
  }

  .header-period-btn {
    width: 22px;
    height: 22px;
  }

  .header-actions {
    gap: 0.4rem;
  }

  .header-actions .btn-text-hide span {
    display: none;
  }

  .header-actions .btn-text-hide {
    padding: 0.4rem;
  }

  .user-profile-badge {
    padding: 0.2rem 0.45rem;
  }

  .user-info-text {
    display: none;
  }

  /* Salary Overview Banner Responsive Fix */
  .salary-overview-banner {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    gap: 0.85rem;
  }

  .salary-info-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
    width: 100%;
  }

  .salary-pill {
    width: 100%;
    display: flex;
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.35rem;
  }

  .salary-pill-value {
    font-size: 1.25rem;
  }

  .extra-income-tags-cloud {
    width: 100%;
    gap: 0.4rem;
  }

  .salary-actions-right {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }

  .salary-actions-right .btn {
    width: 100%;
    font-size: 0.775rem;
    padding: 0.5rem 0.4rem;
    justify-content: center;
  }

  /* KPI Grid: Exactly 2 Columns on Mobile */
  .kpi-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.65rem;
  }

  .kpi-card {
    padding: 0.875rem 0.75rem;
    min-height: 120px;
  }

  .kpi-card-header {
    margin-bottom: 0.35rem;
  }

  .kpi-icon {
    width: 32px;
    height: 32px;
  }

  .kpi-icon svg {
    width: 16px;
    height: 16px;
  }

  .kpi-title {
    font-size: 0.65rem;
    letter-spacing: 0.02em;
  }

  .kpi-amount {
    font-size: 1.2rem;
    margin: 0.1rem 0 0.25rem;
  }

  .kpi-subtext {
    font-size: 0.65rem;
    line-height: 1.2;
  }

  /* Quincenas Breakdown */
  .quincena-breakdown-row {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .quincena-card {
    padding: 1rem;
  }

  /* Tables vs Mobile Cards */
  .expenses-table-wrapper {
    display: none;
  }

  .mobile-expense-cards {
    display: flex;
  }

  .expenses-section, .savings-section {
    padding: 1rem;
  }

  .savings-vault-grid {
    grid-template-columns: 1fr;
  }

  /* Modals on Mobile */
  .modal-container {
    max-height: 94vh;
    border-radius: var(--radius-lg);
    margin: 0.5rem;
  }

  .modal-header {
    padding: 1rem 1.25rem 0.75rem;
  }

  .modal-body {
    padding: 1rem 1.25rem;
  }

  .modal-footer {
    padding: 0.75rem 1.25rem 1rem;
  }
}

@media (max-width: 480px) {
  .header-brand .brand-title {
    display: none;
  }

  .header-period-label {
    min-width: 75px;
    font-size: 0.725rem;
  }

  .auth-form-panel {
    padding: 1.5rem 1rem;
  }

  .kpi-amount {
    font-size: 1.1rem;
  }
}
