/* ========================================
   BudgWise Modern Theme - Mobile-First Design
   ======================================== */

:root {
  --primary: #3b7ddd;
  --secondary: #6c757d;
  --success: #1cbb8c;
  --danger: #dc3545;
  --warning: #fcb92c;
  --info: #17a2b8;
  --light: #f5f7fb;
  --dark: #2c3e50;
  --sidebar-width: 260px;
  --navbar-height: 60px;
  --border-radius: 0.5rem;
  --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
  --transition: all 0.3s ease;
}

/* Base Typography */
html {
  font-size: 13px;
  scroll-behavior: smooth;
}

@media (min-width: 768px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 1200px) {
  html {
    font-size: 15px;
  }
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', sans-serif;
  background-color: var(--light);
  color: var(--dark);
  line-height: 1.6;
  margin: 0;
  padding: 0;
}

/* Headings - Reduced Sizes */
h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 1rem;
  line-height: 1.2;
}

h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 0.875rem;
  line-height: 1.3;
}

h3 {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

h4 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.625rem;
}

h5 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

h6 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Hide icons in page titles */
h1 > i.fas, h2 > i.fas, h3 > i.fas {
  display: none;
}

/* Modern Navbar */
.navbar {
  height: var(--navbar-height);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  padding: 0 1.5rem;
}

.navbar-brand img {
  transition: transform 0.3s ease;
}

.navbar-brand:hover img {
  transform: rotate(-10deg) scale(1.1);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
}

.nav-link {
  font-weight: 500;
  transition: var(--transition);
  border-radius: var(--border-radius);
  padding: 0.5rem 1rem !important;
  margin: 0 0.25rem;
}

.nav-link:hover {
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

/* Modern Cards */
.card {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  transition: var(--transition);
  margin-bottom: 1rem;
}

.card:hover {
  box-shadow: var(--box-shadow-lg);
  transform: translateY(-2px);
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 0.875rem 1rem;
  font-weight: 600;
  font-size: 0.95rem;
}

.card-body {
  padding: 1rem;
}

/* Modern Buttons */
.btn {
  border-radius: var(--border-radius);
  font-weight: 500;
  padding: 0.625rem 1.25rem;
  transition: var(--transition);
  border: none;
  box-shadow: var(--box-shadow);
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--box-shadow-lg);
}

.btn:focus, .btn:active:focus {
  box-shadow: 0 0 0 0.2rem rgba(59, 125, 221, 0.25);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.btn-success {
  background-color: var(--success);
}

.btn-warning {
  background-color: var(--warning);
  color: var(--dark);
}

.btn-danger {
  background-color: var(--danger);
}

.btn-lg {
  padding: 0.875rem 1.5rem;
  font-size: 1.1rem;
}

/* Modern Forms */
.form-control {
  border: 1px solid #e3e6ef;
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  transition: var(--transition);
  font-size: 0.95rem;
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.2rem rgba(59, 125, 221, 0.15);
}

.form-label {
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--dark);
  font-size: 0.9rem;
}

/* Modern Tables */
.table {
  background-color: white;
  border-radius: var(--border-radius);
  overflow: hidden;
}

.table thead th {
  background-color: var(--light);
  border-bottom: 2px solid #dee2e6;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
  padding: 1rem;
}

.table tbody tr {
  transition: var(--transition);
}

.table tbody tr:hover {
  background-color: rgba(59, 125, 221, 0.05);
  transform: scale(1.01);
}

/* Badges */
.badge {
  padding: 0.5em 0.85em;
  border-radius: 0.35rem;
  font-weight: 600;
  font-size: 0.8rem;
}

/* Stats Cards */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 100px;
  height: 100px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
  border-radius: 50%;
  transform: translate(30%, -30%);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  margin: 0.25rem 0;
}

.stat-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.8;
  font-weight: 600;
}

/* Progress Bars */
.progress {
  height: 0.75rem;
  border-radius: 1rem;
  background-color: #e9ecef;
  overflow: visible;
}

.progress-bar {
  border-radius: 1rem;
  box-shadow: var(--box-shadow);
  transition: width 0.6s ease;
}

/* Alerts */
.alert {
  border: none;
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  border-left: 3px solid;
  font-size: 0.9rem;
}

.alert-success {
  background-color: rgba(28, 187, 140, 0.1);
  border-left-color: var(--success);
  color: var(--success);
}

.alert-danger {
  background-color: rgba(220, 53, 69, 0.1);
  border-left-color: var(--danger);
  color: var(--danger);
}

.alert-warning {
  background-color: rgba(252, 185, 44, 0.1);
  border-left-color: var(--warning);
  color: #946c00;
}

.alert-info {
  background-color: rgba(23, 162, 184, 0.1);
  border-left-color: var(--info);
  color: var(--info);
}

/* Dropdown Menus */
.dropdown-menu {
  border: none;
  box-shadow: var(--box-shadow-lg);
  border-radius: var(--border-radius);
  padding: 0.5rem;
}

.dropdown-item {
  border-radius: 0.375rem;
  padding: 0.5rem 1rem;
  transition: var(--transition);
  font-size: 0.9rem;
}

.dropdown-item:hover {
  background-color: var(--light);
  transform: translateX(4px);
}

.dropdown-divider {
  margin: 0.5rem 0;
}

/* Icons */
.icon {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--border-radius);
  font-size: 1.25rem;
}

.icon-primary {
  background-color: rgba(59, 125, 221, 0.1);
  color: var(--primary);
}

.icon-success {
  background-color: rgba(28, 187, 140, 0.1);
  color: var(--success);
}

.icon-warning {
  background-color: rgba(252, 185, 44, 0.1);
  color: var(--warning);
}

.icon-danger {
  background-color: rgba(220, 53, 69, 0.1);
  color: var(--danger);
}

/* Container */
.container, .container-fluid {
  padding-top: 1rem;
  padding-bottom: 1rem;
}

/* Responsive Grid Spacing */
.g-4 {
  --bs-gutter-y: 1rem;
}

/* Modal */
.modal-content {
  border: none;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow-lg);
}

.modal-header {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

.modal-body {
  padding: 1.5rem;
}

/* Footer */
.footer {
  background-color: white;
  padding: 1rem 0;
  margin-top: 2rem;
  box-shadow: 0 -0.125rem 0.25rem rgba(0, 0, 0, 0.075);
  font-size: 0.85rem;
}

/* Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--light);
}

::-webkit-scrollbar-thumb {
  background: var(--secondary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--dark);
}

/* Mobile Optimizations */
@media (max-width: 767.98px) {
  .navbar {
    padding: 0 1rem;
  }

  .navbar-brand {
    font-size: 1.25rem;
  }

  .card-body {
    padding: 1rem;
  }

  .stat-value {
    font-size: 1.5rem;
  }

  .container, .container-fluid {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }

  .btn {
    padding: 0.625rem 1rem;
    font-size: 0.9rem;
  }

  .btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
  }

  .table {
    font-size: 0.85rem;
  }

  .table thead th,
  .table tbody td {
    padding: 0.75rem 0.5rem;
  }

  /* Cards mobile */
  .card {
    border-radius: 12px;
  }

  .card-header {
    padding: 1rem;
    font-size: 0.95rem;
  }

  /* Forms mobile */
  .form-control, .form-select {
    font-size: 16px; /* Prevent zoom on iOS */
  }

  /* Alerts mobile */
  .alert {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
  }

  /* Badges */
  .badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
  }

  /* Modals */
  .modal-body {
    padding: 1rem;
  }

  .modal-header {
    padding: 1rem;
  }

  /* Touch targets - min 44px */
  a, button, .nav-link, .btn, .form-check-input {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  /* Reduce spacing on mobile */
  .mb-3 { margin-bottom: 1rem !important; }
  .mb-4 { margin-bottom: 1.5rem !important; }
  .mt-3 { margin-top: 1rem !important; }
  .mt-4 { margin-top: 1.5rem !important; }

  /* Hide unnecessary text on mobile */
  .mobile-hide-text {
    font-size: 0;
  }

  .mobile-hide-text i {
    font-size: 1rem;
  }
}

/* Tablet Optimizations */
@media (min-width: 768px) and (max-width: 991.98px) {
  .stat-value {
    font-size: 1.75rem;
  }
}

/* Compact Spacing Utilities */
.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 0.75rem !important; }
.mb-4 { margin-bottom: 1rem !important; }
.mb-5 { margin-bottom: 1.25rem !important; }

.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 0.75rem !important; }
.mt-4 { margin-top: 1rem !important; }
.mt-5 { margin-top: 1.25rem !important; }

.py-2 { padding-top: 0.5rem !important; padding-bottom: 0.5rem !important; }
.py-3 { padding-top: 0.75rem !important; padding-bottom: 0.75rem !important; }
.py-4 { padding-top: 1rem !important; padding-bottom: 1rem !important; }

/* Compact row spacing */
.row.compact {
  margin-left: -0.5rem;
  margin-right: -0.5rem;
}

.row.compact > * {
  padding-left: 0.5rem;
  padding-right: 0.5rem;
}

/* Print Styles */
/* Checkboxes - Mobile Improvements */
.form-check-input {
  width: 1.25rem;
  height: 1.25rem;
  margin-top: 0.125rem;
  cursor: pointer;
}

.form-check-label {
  cursor: pointer;
  margin-left: 0.5rem;
}

.form-check {
  display: flex;
  align-items: center;
  padding-left: 0;
  min-height: 1.5rem;
}

@media (max-width: 767.98px) {
  .form-check-input {
    width: 1.5rem;
    height: 1.5rem;
  }

  .form-check-label {
    font-size: 0.95rem;
    margin-left: 0.75rem;
  }
}

/* Button Improvements - Mobile */
@media (max-width: 767.98px) {
  .btn {
    padding: 0.5rem 0.875rem;
  }

  .btn i {
    margin-right: 0;
  }

  .btn-group {
    gap: 0;
  }

  .btn-group .btn {
    margin: 0;
    padding: 0.4rem 0.6rem;
  }

  .btn-group-sm .btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
  }

  /* Hide text in action buttons on mobile, keep only icons */
  .card-header .btn-group .btn span {
    display: none;
  }
}

/* Badge Improvements */
.badge {
  padding: 0.4rem 0.75rem;
  font-weight: 600;
  font-size: 0.75rem;
  border-radius: 0.375rem;
  letter-spacing: 0.02em;
}

.badge i {
  margin-right: 0.25rem;
}

@media print {
  .navbar,
  .footer,
  .btn,
  .dropdown {
    display: none !important;
  }

  .card {
    box-shadow: none;
    border: 1px solid #ddd;
  }
}