/* Estilos base iOS */
:root {
  --ios-blue: #007aff;
  --ios-green: #34c759;
  --ios-red: #ff3b30;
  --ios-gray: #8e8e93;
  --ios-light-gray: #f2f2f7;
  --ios-dark-gray: #1c1c1e;
  --ios-background: #f2f2f7;
  --ios-card-background: #ffffff;
  --ios-radius: 10px;
  --ios-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

html {
  font-size: 14px;
  position: relative;
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem var(--ios-blue);
}

body {
  margin-bottom: 60px;
  padding-top: 60px;
  background-color: var(--ios-background);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Barra de navegação estilo iOS */
.navbar {
  background-color: rgba(255, 255, 255, 0.8) !important;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
}

.navbar-brand {
  font-weight: 600;
  color: var(--ios-blue) !important;
}

.navbar-dark .navbar-toggler {
  border: none;
  padding: 0.25rem 0.5rem;
}

.navbar-dark .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%280, 122, 255, 1%29' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Footer estilo iOS */
.footer {
  position: absolute;
  bottom: 0;
  width: 100%;
  white-space: nowrap;
  line-height: 60px;
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  color: var(--ios-gray);
  font-size: 0.9rem;
}

/* Estilos personalizados iOS */
.balance-section .card {
  transition: transform 0.2s;
  border-radius: var(--ios-radius);
  border: none;
  box-shadow: var(--ios-shadow);
  padding: 1rem;
  background-color: var(--ios-card-background);
}

.balance-section .card:hover {
  transform: translateY(-3px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.table-responsive {
  max-height: 500px;
  overflow-y: auto;
  border-radius: var(--ios-radius);
  background-color: var(--ios-card-background);
  box-shadow: var(--ios-shadow);
}

/* Cores personalizadas para receitas e despesas no estilo iOS */
.text-success {
  color: var(--ios-green) !important;
}

.text-danger {
  color: var(--ios-red) !important;
}

/* Estilo para os cards de saldo no estilo iOS */
.balance-card {
  background: linear-gradient(135deg, var(--ios-blue), #5ac8fa);
  color: white;
  padding: 1.5rem;
  border-radius: var(--ios-radius);
  text-align: center;
  box-shadow: var(--ios-shadow);
}

.balance-card h2 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  font-weight: 600;
}

.balance-card .balance {
  font-size: 2rem;
  font-weight: 700;
  margin: 0;
}

/* Botões estilo iOS */
.btn {
  border-radius: 8px;
  font-weight: 600;
  padding: 0.5rem 1rem;
  transition: all 0.2s;
}

.btn-primary {
  background-color: var(--ios-blue);
  border-color: var(--ios-blue);
}

.btn-primary:hover, .btn-primary:focus {
  background-color: #0056b3;
  border-color: #0056b3;
}

.btn-success {
  background-color: var(--ios-green);
  border-color: var(--ios-green);
}

.btn-danger {
  background-color: var(--ios-red);
  border-color: var(--ios-red);
}

/* Inputs estilo iOS */
.form-control {
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0.75rem 1rem;
  background-color: rgba(255, 255, 255, 0.8);
  transition: all 0.2s;
}

.form-control:focus {
  border-color: var(--ios-blue);
  background-color: #fff;
}

/* Estilos do Calendário */
.table-bordered > :not(caption) > * > * {
  padding: 0.5rem;
}

.table {
  border-radius: var(--ios-radius);
  overflow: hidden;
  box-shadow: var(--ios-shadow);
}

.table td {
  vertical-align: top;
  transition: background-color 0.2s;
  border-color: rgba(0, 0, 0, 0.05);
}

.table td:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

.table-primary {
  --bs-table-bg: rgba(0, 122, 255, 0.1);
}

.text-muted {
  color: var(--ios-gray) !important;
  opacity: 0.8;
}

/* Responsividade */
@media (max-width: 576px) {
  .balance-card .balance {
    font-size: 1.5rem;
  }
  
  .card-title {
    font-size: 1rem;
  }
  
  .card-text {
    font-size: 1.2rem;
  }

  /* Ajustes do calendário para mobile */
  .table-responsive {
    max-height: none;
  }

  .table td {
    padding: 0.25rem;
  }

  .table td div {
    font-size: 0.7rem;
  }
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
  color: var(--ios-gray);
  text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
  text-align: start;
}

/* Menu Lateral estilo iOS */
.sidebar {
  position: fixed;
  top: 60px;
  bottom: 0;
  left: 0;
  z-index: 100;
  padding: 0;
  background-color: rgba(245, 245, 245, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  overflow-y: auto;
  border-right: 1px solid rgba(0, 0, 0, 0.1);
}

.sidebar .list-group-item {
  border-radius: 0;
  border: none;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1rem 1.5rem;
  color: #333;
  font-weight: 500;
}

.sidebar .list-group-item.active {
  background-color: transparent;
  color: var(--ios-blue);
  border-left: 3px solid var(--ios-blue);
  padding-left: calc(1.5rem - 3px);
}

.sidebar .list-group-item i {
  width: 20px;
  text-align: center;
  margin-right: 10px;
  color: var(--ios-gray);
}

.sidebar .list-group-item.active i {
  color: var(--ios-blue);
}

/* Ajustes para Mobile */
@media (max-width: 991.98px) {
  .offcanvas-lg {
    background-color: rgba(245, 245, 245, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  
  main {
    width: 100%;
    margin-left: 0 !important;
  }
}

@media (min-width: 992px) {
  main {
    margin-left: 16.666667% !important;
  }
  
  .offcanvas-lg {
    transform: none !important;
    visibility: visible !important;
  }
}

/* Dark Mode estilo iOS */
[data-bs-theme="dark"] {
  --ios-background: #000000;
  --ios-card-background: #1c1c1e;
  --ios-light-gray: #2c2c2e;
  --bs-body-bg: #000000;
  --bs-body-color: #ffffff;
}

[data-bs-theme="dark"] .navbar {
  background-color: rgba(28, 28, 30, 0.9) !important;
}

[data-bs-theme="dark"] .navbar-brand {
  color: #ffffff !important;
}

[data-bs-theme="dark"] .navbar .nav-link {
  color: #ffffff !important;
}

[data-bs-theme="dark"] .navbar .btn-link {
  color: #ffffff !important;
}

[data-bs-theme="dark"] .footer {
  background-color: rgba(28, 28, 30, 0.9);
  color: #ffffff;
}

[data-bs-theme="dark"] .sidebar,
[data-bs-theme="dark"] .offcanvas {
  background-color: rgba(28, 28, 30, 0.9);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .list-group-item {
  background-color: transparent;
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

[data-bs-theme="dark"] .list-group-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .list-group-item.active {
  background-color: rgba(0, 122, 255, 0.2);
  color: #ffffff;
  border-left: 3px solid var(--ios-blue);
}

[data-bs-theme="dark"] .list-group-item i {
  color: rgba(255, 255, 255, 0.7);
}

[data-bs-theme="dark"] .list-group-item.active i {
  color: var(--ios-blue);
}

[data-bs-theme="dark"] .dropdown-menu {
  background-color: rgba(40, 40, 40, 0.95);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .dropdown-item {
  color: #ffffff;
}

[data-bs-theme="dark"] .dropdown-item:hover,
[data-bs-theme="dark"] .dropdown-item:focus {
  background-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .dropdown-divider {
  border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .form-control {
  background-color: rgba(60, 60, 60, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
  color: white;
}

[data-bs-theme="dark"] .table td {
  border-color: rgba(255, 255, 255, 0.1);
}

/* Animações */
.sidebar .list-group-item {
  transition: all 0.2s ease-in-out;
}

.sidebar .list-group-item:hover {
  background-color: rgba(0, 0, 0, 0.02);
}

/* Scrollbar personalizada estilo iOS */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

/* Estilo de cards iOS */
.card {
  border-radius: var(--ios-radius);
  border: none;
  box-shadow: var(--ios-shadow);
  overflow: hidden;
}

.card-header {
  background-color: transparent;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  font-weight: 600;
}

/* Estilo de tabelas iOS */
.table {
  background-color: var(--ios-card-background);
}

/* Estilo de avisos e alertas iOS */
.alert {
  border: none;
  border-radius: var(--ios-radius);
  padding: 1rem;
}

.alert-primary {
  background-color: rgba(0, 122, 255, 0.1);
  color: var(--ios-blue);
}

.alert-success {
  background-color: rgba(52, 199, 89, 0.1);
  color: var(--ios-green);
}

.alert-danger {
  background-color: rgba(255, 59, 48, 0.1);
  color: var(--ios-red);
}

/* Barra de navegação inferior estilo iOS */
.ios-bottom-navigation {
  background-color: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid rgba(0, 0, 0, 0.1);
  padding: 10px 0;
  height: 70px;
}

.ios-bottom-navigation .row {
  height: 100%;
}

.ios-bottom-navigation a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--ios-gray);
  text-decoration: none;
  font-size: 0.8rem;
  height: 100%;
  transition: color 0.2s;
}

.ios-bottom-navigation a.active {
  color: var(--ios-blue);
}

.ios-bottom-navigation i {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.ios-bottom-navigation span {
  font-size: 0.7rem;
  font-weight: 500;
}

/* Ajuste para o body quando temos a barra de navegação inferior */
@media (max-width: 991.98px) {
  body {
    margin-bottom: 70px;
  }
  
  .footer {
    display: none;
  }
}

/* Dark Mode para a barra de navegação inferior */
[data-bs-theme="dark"] .ios-bottom-navigation {
  background-color: rgba(28, 28, 30, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .ios-bottom-navigation a {
  color: rgba(255, 255, 255, 0.7);
}

[data-bs-theme="dark"] .ios-bottom-navigation a.active {
  color: var(--ios-blue);
}

[data-bs-theme="dark"] .ios-bottom-navigation span {
  font-weight: 500;
}

/* Dark Mode para os cards e componentes */
[data-bs-theme="dark"] .card {
  background-color: rgba(40, 40, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

[data-bs-theme="dark"] .card-header {
  background-color: rgba(50, 50, 50, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

[data-bs-theme="dark"] .card-body {
  color: #ffffff;
}

[data-bs-theme="dark"] .card-footer {
  background-color: rgba(50, 50, 50, 0.9);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .text-muted {
  color: rgba(255, 255, 255, 0.7) !important;
}

/* Melhorar contraste em tabelas no modo escuro */
[data-bs-theme="dark"] .table {
  color: #ffffff;
}

[data-bs-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > * {
  background-color: rgba(255, 255, 255, 0.05);
  color: #ffffff;
}

[data-bs-theme="dark"] .table-hover > tbody > tr:hover > * {
  background-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

[data-bs-theme="dark"] .btn-outline-primary {
  color: var(--ios-blue);
  border-color: var(--ios-blue);
}

[data-bs-theme="dark"] .btn-outline-primary:hover {
  background-color: var(--ios-blue);
  color: #ffffff;
}

/* Melhorar contraste dos formulários no modo escuro */
[data-bs-theme="dark"] .form-select {
  background-color: rgba(60, 60, 60, 0.5);
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

[data-bs-theme="dark"] .form-select:focus {
  border-color: var(--ios-blue);
  box-shadow: 0 0 0 0.25rem rgba(0, 122, 255, 0.25);
}

[data-bs-theme="dark"] .form-label {
  color: #ffffff;
}

[data-bs-theme="dark"] .form-control::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

[data-bs-theme="dark"] .modal-content {
  background-color: rgba(40, 40, 40, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .modal-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .modal-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}