/* ============================================================
   modern-ux.css — Indcloud ERP
   Centraliza TODOS os estilos de UI modernizados.
   NUNCA adicionar <style> inline nas Razor Pages.
   Adicione aqui qualquer nova classe estrutural genérica.
   ============================================================ */

/* ── Fundo global SaaS ────────────────────────────────────── */
body.bg-moderno {
    background-color: #fafbfc !important;
    background-image: none !important;
}

/* ── Layout do módulo (substitui resume-section) ─────────── */
.modulo-wrapper {
    min-height: calc(100vh - 50px); /* 50px = altura do footer */
    display: flex;
    flex-direction: column;
}

.modulo-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px 8px 24px;
    border-bottom: 2px solid #e2e8f0;
    background: #fff;
    margin-bottom: 0;
}

.modulo-logo {
    max-height: 44px;
    width: auto;
    margin-left: -10px;
}

.modulo-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.modulo-usuario {
    font-size: 0.82rem;
    color: #64748b;
    font-style: italic;
}

.modulo-sessao {
    font-size: 0.72rem;
    color: #94a3b8;
    font-style: normal;
    white-space: nowrap;
    margin-top: 2px;
}

.modulo-content {
    flex: 1;
    padding: 24px 28px 80px 28px; /* 80px para não ficar atrás do footer */
}

@media (max-width: 991.98px) {
    .modulo-content {
        padding: 16px 14px 80px 14px;
    }
    .modulo-header {
        padding: 10px 14px 8px 14px;
    }
}

/* ── Card padrão ──────────────────────────────────────────── */
.card-moderno {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}

.card-header-moderno {
    font-size: 1rem;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Tabela moderna ───────────────────────────────────────── */
.table-moderna {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: #fff;
}

.table-moderna thead tr {
    background-color: #f1f5f9;
    border-bottom: 2px solid #e2e8f0;
}

.table-moderna thead th {
    padding: 10px 14px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #64748b;
    white-space: nowrap;
}

.table-moderna tbody tr {
    border-bottom: 1px solid #f1f5f9;
    transition: background-color 0.15s ease;
}

.table-moderna tbody tr:hover {
    background-color: #f8fafc;
}

.table-moderna tbody td {
    padding: 9px 14px;
    vertical-align: middle;
    color: #334155;
}

/* ── Ações da grid (deslize da engrenagem) ───────────────── */
.grid-actions-wrapper {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: 36px;
    height: 34px;
}

/* Engrenagem — mesmo tamanho dos botões, sempre visível */
.grid-action-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #e2e8f0;
    color: #64748b;
    font-size: 0.75rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s, transform 0.2s;
    z-index: 2;
}

.grid-actions-wrapper:hover .grid-action-trigger {
    background: #3080C0;
    color: #fff;
    transform: rotate(60deg);
}

/* Menu desliza para a esquerda da engrenagem */
.grid-actions-menu {
    display: none;
    gap: 4px;
    align-items: center;
    position: absolute;
    right: 34px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 20;
    white-space: nowrap;
}

.grid-actions-wrapper:hover .grid-actions-menu {
    display: flex;
    animation: slideFromGear 0.15s ease-out;
}

@keyframes slideFromGear {
    from { opacity: 0; transform: translateY(-50%) translateX(10px); }
    to   { opacity: 1; transform: translateY(-50%) translateX(0); }
}

/* ── Botões circulares de ação ────────────────────────────── */
.btn-action-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    color: #fff !important;
    font-size: 0.75rem;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
}

.btn-action-circle:hover {
    transform: scale(1.15);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.22);
    color: #fff !important;
    text-decoration: none;
}

/* Tooltip nos botões de ação */
.btn-action-circle[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(30, 41, 59, 0.9);
    color: #fff;
    font-size: 0.68rem;
    font-weight: 500;
    white-space: nowrap;
    padding: 3px 8px;
    border-radius: 4px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.btn-action-circle[data-tooltip]:hover::after {
    opacity: 1;
}

/* Cores dos botões de ação */
.bg-action-blue   { background-color: #3080C0; }
.bg-action-yellow { background-color: #f59e0b; }
.bg-action-red    { background-color: #ef4444; }
.bg-action-green  { background-color: #22c55e; }
.bg-action-gray   { background-color: #94a3b8; }

/* ── Logo no conteúdo (LayoutModulo) ─────────────────────── */
.logo-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.logo-fluid {
    max-height: 60px;
    width: auto;
}

/* ── Info do usuário logado ───────────────────────────────── */
.licenciado-container {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    margin-bottom: 0.25rem;
}

.licenciado {
    font-style: italic;
    font-size: 0.85rem;
}

/* ── Breadcrumbs ──────────────────────────────────────────── */
.breadcrumb-moderno {
    font-family: 'Inter', 'Poppins', sans-serif;
    font-size: 14px;
    background: transparent;
    padding: 0;
    margin: 0;
}

.breadcrumb-moderno .breadcrumb-item a {
    color: #3080C0;
    text-decoration: none;
}

.breadcrumb-moderno .breadcrumb-item a:hover {
    text-decoration: underline;
}

.breadcrumb-moderno .breadcrumb-item.active {
    color: #64748b;
}

/* ── Título da página ─────────────────────────────────────── */
.page-title {
    font-size: 1.4rem !important;
    font-weight: 700;
    color: #1e293b;
    text-transform: none !important;
    letter-spacing: 0 !important;
    border-left: 4px solid #3080C0;
    padding-left: 12px;
}

/* ── Link voltar ──────────────────────────────────────────── */
.link-voltar {
    color: #3080C0;
    font-size: 0.85rem;
    text-decoration: none;
    font-weight: 500;
}

.link-voltar:hover {
    color: #1E5E94;
    text-decoration: underline;
}

/* ── Gauge grid (Dashboard / módulos) ────────────────────── */
.gauge-grid {
    display: flex;
    flex-wrap: nowrap;
    justify-content: space-between;
    gap: 16px;
    padding: 0 16px;
    width: 100%;
}

.gauge-container {
    width: 230px;
    flex-shrink: 0;
}

@media (max-width: 1024px) {
    .gauge-grid {
        justify-content: center;
    }
}

@media (max-width: 768px) {
    .gauge-grid {
        overflow-x: auto;
    }

    .gauge-container {
        width: 100% !important;
        min-height: 180px !important;
    }
}

/* ── Fundo da dashboard ───────────────────────────────────── */
.dashboard-fundo {
    background-image: url('/img/backsystem.jpg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
    background-attachment: fixed;
}

/* ── Títulos de seção na dashboard ───────────────────────── */
.section-insight-title {
    text-align: left;
    margin-top: 40px;
    margin-bottom: 12px;
    font-size: 1.05rem !important;
    font-weight: 700;
    color: #1e293b;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Radio customizado ────────────────────────────────────── */
.custom-radio {
    accent-color: #3080C0;
}

/* ── Modal IA grande ──────────────────────────────────────── */
.modal-ai-max .modal-content {
    height: 90vh;
}

#modal-ai .modal-body {
    display: flex;
    flex-direction: column;
    height: calc(90vh - 120px);
    padding: 12px;
}

#modal-ai .conversas-box {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    border: 1px solid #ddd;
    padding: 10px;
    background: #fff;
    border-radius: 8px;
}

#modal-ai .form-row.chat-input-row {
    flex: 0 0 auto;
    padding-top: 10px;
    margin-top: auto;
}

/* ── Botão enviar IA ──────────────────────────────────────── */
.btn-enviar {
    color: #3080C0;
}

.btn-enviar:hover {
    color: #6c757d;
}

/* ── Dropdown Ferramentas (dropup) ───────────────────────── */
.dropup .dropdown-menu {
    border-radius: 12px !important;
    padding: 5px 0;
    margin-bottom: 12px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15) !important;
    min-width: 280px;
    overflow: hidden !important;
    animation: fadeInUpDropdown 0.2s ease-out;
}

.dropdown-item {
    padding: 10px 20px;
    font-size: 14px;
    color: #555;
    display: flex;
    align-items: center;
    border-bottom: 1px solid transparent;
}

.dropdown-item:hover {
    background-color: #f0f7ff;
    color: #3080C0;
    padding-left: 25px;
    transition: all 0.2s ease;
}

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

/* ── Ícones sociais e utilitários do footer ───────────────── */
.social-icon {
    font-size: 18px;
    transition: color 0.2s ease, transform 0.2s ease;
}

.social-icon:hover {
    color: #3080C0 !important;
    transform: translateY(-2px);
}

.action-buttons-group {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.hover-zoom {
    transition: transform 0.2s ease;
    cursor: pointer;
    object-fit: contain;
}

.hover-zoom:hover {
    transform: scale(1.2);
}

.hover-bg:hover {
    background-color: #f0f7ff;
    color: #2a76b3 !important;
}

/* ── KPI Cards (resumo executivo) ────────────────────────── */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    padding: 1.1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.1);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
}

.kpi-body { flex: 1; min-width: 0; }

.kpi-valor {
    font-size: 1.55rem;
    font-weight: 700;
    color: #1e293b;
    line-height: 1;
    margin-bottom: 4px;
}

.kpi-label {
    font-size: 0.75rem;
    color: #64748b;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.kpi-trend {
    font-size: 0.7rem;
    margin-top: 4px;
}

.kpi-trend.up     { color: #22c55e; }
.kpi-trend.down   { color: #ef4444; }
.kpi-trend.neutral{ color: #94a3b8; }

.kpi-icon-blue   { background: #eff6ff; color: #3080C0; }
.kpi-icon-green  { background: #f0fdf4; color: #22c55e; }
.kpi-icon-amber  { background: #fffbeb; color: #f59e0b; }
.kpi-icon-purple { background: #faf5ff; color: #a855f7; }
.kpi-icon-red    { background: #fef2f2; color: #ef4444; }
.kpi-icon-teal   { background: #f0fdfa; color: #14b8a6; }

/* ── Tiles de navegação de módulo ────────────────────────── */
.modulo-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 16px;
    margin-top: 0.5rem;
}

.modulo-tile {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
    padding: 1.25rem 1rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    color: #1e293b;
    border: 1.5px solid #f1f5f9;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.modulo-tile:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(48, 128, 192, 0.14);
    border-color: #3080C0;
    color: #1e293b;
    text-decoration: none;
}

.modulo-tile-icon {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    background: #eff6ff;
    color: #3080C0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    margin-bottom: 0.7rem;
    transition: background 0.2s, color 0.2s;
}

.modulo-tile:hover .modulo-tile-icon {
    background: #3080C0;
    color: #fff;
}

.modulo-tile-title {
    font-size: 0.82rem;
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    margin-bottom: 3px;
}

.modulo-tile-desc {
    font-size: 0.7rem;
    color: #94a3b8;
    line-height: 1.4;
}

.modulo-tile.em-breve {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

/* Tiles grandes (dashboard shortcuts 8 módulos) */
.modulo-tiles.tiles-modulos {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

/* ── Sidebar — item ativo como pill ──────────────────────── */
#sideNav .nav-link.active {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    font-weight: 600;
}

/* ── Foto do sidebar — quadrado arredondado ──────────────── */
#sideNav .navbar-brand .sidebar-logo-rounded {
    border-radius: 18px !important;
}

/* ── Logo do cliente no sidebar ──────────────────────────── */
#sideNav .navbar-brand .sidebar-logo-img {
    width: auto !important;
    height: auto !important;
    max-width: 136px !important;
    max-height: 72px !important;
    min-height: 0 !important;
    border-radius: 10px !important;
    object-fit: contain !important;
    border: none !important;
    background: rgba(255, 255, 255, 0.1);
    padding: 6px 12px;
    display: block;
    margin: 0 auto;
}

/* No estado retraído, oculta o logo (sidebar fica só com ícones) */
#sideNav.retraido .navbar-brand .sidebar-logo-img {
    display: none !important;
}

/* ── Modal de bloqueio de servidor ───────────────────────── */
#modalBloqueioIIS {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2147483647;
    text-align: center;
    backdrop-filter: blur(4px);
}

.modal-iis-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

@keyframes spinIIS {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.spinner-iis {
    width: 60px;
    height: 60px;
    border: 6px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top: 6px solid #fff;
    animation: spinIIS 1s linear infinite;
    margin: 0 auto 20px auto;
}
