/* ==========================================================================
   ÍNDICE
   1. UTILIDADES GERAIS
   2. NAVEGAÇÃO & HEADER (Toggle)
   3. COMPONENTES DE UI (Switch, Dropdowns)
   4. PLUGINS & VENDORS (Flatpickr)
   5. MÓDULOS ESPECÍFICOS (Anexos)
   6. RESPONSIVIDADE & MOBILE (Gmail List, Tables)
   ========================================================================== */
body.has-pwa-bottom {
    padding-bottom: calc(70px + env(safe-area-inset-bottom));
}

/* ==========================================================================
   1. UTILIDADES GERAIS
   ========================================================================== */
.top-10 {
  top: 10% !important;
}

/* ==========================================================================
   2. NAVEGAÇÃO & HEADER
   ========================================================================== */
/* Hamburger Toggle Animado */
.hamburger-toggle {
  width: 30px;
  height: 20px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.3s ease;
}

.hamburger-line {
  width: 100%;
  height: 3px;
  background-color: var(--bs-white); /* Ajustado conforme seu input */
  border-radius: 4px;
  transform-origin: left;
  transition: all 0.3s ease;
}

/* Estados de Animação (Aberto) */
.navbar-toggler[aria-expanded="true"] .hamburger-line:first-child {
  transform: rotate(45deg);
}

.navbar-toggler[aria-expanded="true"] .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.navbar-toggler[aria-expanded="true"] .hamburger-line:last-child {
  transform: rotate(-45deg);
}

/* ==========================================================================
   3. COMPONENTES DE UI
   ========================================================================== */

/* --- Switch iOS (ZapSuiteX) --- */
.ios-switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

.ios-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background-color: #d1d1d1;
  transition: 0.3s;
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

input:checked + .slider {
  background-color: var(--bs-primary);
}

input:checked + .slider:before {
  transform: translateX(22px);
}

.slider:active:before {
  width: 22px;
}

/* --- Dropdown Notifications --- */
.notification-hover {
  transition: background-color 0.2s ease;
  background-color: #fff;
}

.notification-hover:hover {
  background-color: #f8f9fa;
}

.notification-hover:active {
  background-color: #e9ecef;
}

/* Scrollbar fina para Dropdowns */
.dropdown-menu ::-webkit-scrollbar {
  width: 4px;
}

.dropdown-menu ::-webkit-scrollbar-track {
  background: #f1f1f1;
}

.dropdown-menu ::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 4px;
}

.dropdown-menu ::-webkit-scrollbar-thumb:hover {
  background: #bbb;
}

/* ==========================================================================
   4. PLUGINS & VENDORS (Flatpickr, etc)
   ========================================================================== */
.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
  background: var(--bs-primary) !important;
  border-color: var(--bs-primary) !important;
  color: #fff !important;
}

.flatpickr-day.selected:hover {
  background-color: color-mix(in srgb, var(--bs-primary) 80%, black) !important;
  border-color: color-mix(in srgb, var(--bs-primary) 80%, black) !important;
}

.flatpickr-day.selected:focus {
  background: color-mix(in srgb, var(--bs-primary) 80%, black) !important;
  color: #fff !important;
}

/* ==========================================================================
   5. MÓDULOS ESPECÍFICOS (Anexos, Cards, etc)
   ========================================================================== */
.anexo-thumb {
  background: var(--bs-body-bg);
  transition: 0.2s ease;
  cursor: pointer;
}

.anexo-thumb:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.anexo-thumb img {
  width: 100%;
  height: 130px;
  object-fit: cover;
  border-radius: 0.5rem;
}

.anexo-file-icon {
  height: 130px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.5rem;
}
.hover-card {
    transition: transform .15s ease, box-shadow .15s ease;
}
.hover-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 18px rgba(0,0,0,.12);
}
/* ==========================================================================
   6. RESPONSIVIDADE & MOBILE
   ========================================================================== */

@media (max-width: 768px) {
  /* --- Gmail List Style --- */
  .gmail-item {
    padding: 0.8rem 0.5rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .gmail-item .form-check-input {
    transform: scale(1);
    margin-top: 3px;
  }

  .gmail-item .content-wrapper {
    min-width: 0;
    flex-basis: calc(100% - 90px);
  }

  .gmail-item .header-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    margin-bottom: 2px;
  }

  .gmail-item .title {
    font-size: 0.9rem;
    margin-right: 0;
    width: 100%;
  }

  .gmail-item .date-info {
    font-size: 0.7rem;
    color: var(--bs-gray-500);
    margin-top: 2px;
  }

  .gmail-item .preview {
    font-size: 0.8rem;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .gmail-item .actions {
    opacity: 1 !important;
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
    padding-top: 0.5rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.05);
    margin-top: 0.5rem;
    gap: 1rem;
  }

  .action-btn {
    width: 36px;
    height: 36px;
    background-color: rgba(0, 0, 0, 0.03);
  }

  /* --- Mobile Table Pro (2025) --- */
  .mobile-friendly-table thead {
    display: none !important;
  }

  .mobile-friendly-table tbody tr {
    display: block;
    background: var(--bs-body-bg, #fff);
    border-radius: 18px;
    border: 1px solid rgba(0, 0, 0, 0.05);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.3rem;
    overflow: hidden;
    backdrop-filter: blur(6px);
    transform: translateY(0);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
  }

  .mobile-friendly-table tbody tr:active {
    transform: scale(0.985);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  }

  .mobile-friendly-table tbody td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.055);
    font-size: 0.95rem;
    gap: 1rem;
    min-height: 52px;
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(5px);
  }

  .mobile-friendly-table tbody td:last-child {
    border-bottom: none;
  }

  .mobile-friendly-table tbody td::before {
    content: attr(data-label);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    opacity: 0.75;
    color: var(--bs-gray-700);
    flex-shrink: 0;
    margin-right: 0.75rem;
  }

  .mobile-friendly-table tbody td[data-primary="true"] {
    background: linear-gradient(
      135deg,
      rgba(var(--bs-primary-rgb), 0.12),
      rgba(var(--bs-primary-rgb), 0.06)
    );
    border-bottom: 1px solid rgba(var(--bs-primary-rgb), 0.15);
    font-size: 1.12rem;
    font-weight: 700;
    padding-top: 1.2rem;
    padding-bottom: 1.2rem;
  }

  .mobile-friendly-table tbody td[data-primary="true"] a {
    color: var(--bs-primary) !important;
  }

  .mobile-friendly-table .badge {
    padding: 0.45rem 0.65rem;
    border-radius: 10px !important;
    font-size: 0.76rem !important;
    font-weight: 600;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.12);
  }

  /* Actions Toolbar */
  .mobile-friendly-table tbody td[data-label="AÇÕES"],
  .mobile-friendly-table tbody td[data-label="Ações"] {
    background: linear-gradient(to bottom, #fafafa, #f3f3f3);
    padding: 1rem;
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    border-bottom: none;
  }

  .mobile-friendly-table tbody td[data-label="AÇÕES"]::before,
  .mobile-friendly-table tbody td[data-label="Ações"]::before {
    display: none;
  }

  .mobile-friendly-table tbody td[data-label="AÇÕES"] .btn,
  .mobile-friendly-table tbody td[data-label="Ações"] .btn {
    flex: 1;
    padding: 0.7rem 0.4rem;
    font-size: 0.85rem;
    border-radius: 12px !important;
    font-weight: 600;
  }

  .mobile-friendly-table tbody td a {
    white-space: normal !important;
    word-break: break-word !important;
    font-weight: 600;
  }

  .mobile-friendly-table tbody td:empty {
    display: none;
  }
}

/* =============================== */
/* 🌙 OVERLAY DE CARREGAMENTO      */
/* =============================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(2px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

/* Spinner minimalista */
.loading-spinner {
  width: 55px;
  height: 55px;
  border: 5px solid #ddd;
  border-top-color: var(--bs-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-text {
  margin-top: 15px;
  font-weight: 600;
  color: #333;
}

/* Realça campos com erro */
.error-feedback {
    color: #dc3545;
    font-size: .85rem;
    margin-top: 4px;
}

.item-row.error-highlight {
    border: 2px solid #dc3545 !important;
    animation: shake 0.3s ease;
}

/* Suave ao adicionar */
.item-row.added {
    animation: fadeInScale 0.35s ease-out;
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(.97); }
    to { opacity: 1; transform: scale(1); }
}

/* Remover */
.item-row.removed {
    animation: fadeOut 0.25s ease forwards;
}

@keyframes fadeOut {
    to { opacity: 0; height: 0; margin: 0; padding: 0; }
}

/* Shake quando há erro */
@keyframes shake {
    0% { transform: translateX(0); }
    25% { transform: translateX(-4px); }
    50% { transform: translateX(4px); }
    75% { transform: translateX(-4px); }
    100% { transform: translateX(0); }
}

@media (max-width: 991px) {
    .navbar .dropdown-notificacoes,
    .navbar .dropdown-user {
        display: none !important;
    }
}

/* ========================================================= */
/* 📱 PWA / MOBILE – MODAIS SAFE AREA (FINAL)               */
/* iOS / Android / Standalone                               */
/* Não corta header nem footer                              */
/* ========================================================= */

@media (max-width: 768px) {

    .modal {
        padding:
            calc(env(safe-area-inset-top) + 12px)
            calc(env(safe-area-inset-right) + 12px)
            calc(env(safe-area-inset-bottom) + 82px)
            calc(env(safe-area-inset-left) + 12px)
            !important;
    }

    .modal-dialog {
        margin: 0 auto !important;
        max-width: 100% !important;
    }

    .modal-content {
        border-radius: 20px !important;
        max-height: calc(
            100vh
            - env(safe-area-inset-top)
            - env(safe-area-inset-bottom)
            - 94px
        );
        overflow-y: auto;
    }

}
/* ========================================================= */
/* 📲 iOS PWA INSTALL PROMPT – FIXO E SEGURO                */
/* ========================================================= */

.ios-pwa-prompt {
    position: fixed;
    left: 12px;
    right: 12px;

    /* Fica acima da barra inferior */
    bottom: calc(env(safe-area-inset-bottom) + 72px);

    background: var(--bs-body-bg);
    border-radius: 16px;
    padding: 12px 14px;

    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    border: 1px solid var(--bs-border-color-translucent);

    z-index: 1050;
    animation: iosSlideUp .35s ease-out;
}

.ios-prompt-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.ios-prompt-icon {
    font-size: 1.2rem;
}

.ios-prompt-text {
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.4;
}

/* Ícone share estilo iOS */
.share-icon {
    font-family: -apple-system, BlinkMacSystemFont;
    font-weight: 600;
    padding: 0 4px;
}

/* Animação */
@keyframes iosSlideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* ========================================================= */
/* 📸 BOTÃO TIRAR FOTO – PWA / APP STYLE                     */
/* ========================================================= */

.btn-camera-primary {
    background-color: var(--bs-primary); /* mesma cor do header */
    color: #fff;
    border-radius: 14px;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 6px 16px rgba(0,0,0,.25);
    transition: transform .15s ease, box-shadow .15s ease;
}

.btn-camera-primary i {
    font-size: 1.1rem;
}

.btn-camera-primary:active {
    transform: scale(0.97);
    box-shadow: 0 3px 10px rgba(0,0,0,.35);
}

@media (max-width: 768px) {
    .btn-camera-primary {
        padding: 10px 22px;
    }
}

.pwa-offcanvas-header {
    border-bottom: 1px solid #eee;
    background: #fff;
}

.pwa-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--bs-danger);
    color: var(--bs-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}

.pwa-section-title {
    padding: 10px 16px;
    font-size: .95rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--bs-primary);
    background: #f8f9fa;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
    display: flex;
    align-items: center;
}
.pwa-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    font-size: .95rem;
    border: none;
}

.pwa-menu-item i {
    font-size: 1.2rem;
    color: var(--bs-primary);
}

.pwa-menu-item:active {
    background: rgba(0, 0, 0, .04);
}
.offcanvas {
    --bs-offcanvas-width: 320px;
}

.list-group-item {
    background: transparent;
}
