﻿/* =============================================================================
   ESTRUTURA GLOBAL E RESET DE SCROLL
   ============================================================================= */
html, body {
    height: 100%;
    margin: 0;
    overflow: hidden;
}

.mud-layout {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.content-container {
    height: calc(100vh - 64px - 40px + 16px);
    overflow: hidden !important;
    display: flex;
    flex-direction: column;
    padding: 16px;
}

/* =============================================================================
   CARD E CONTEÚDO
   ============================================================================= */
.main-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background-color: #fafafa;
}

.main-card-content {
    flex-grow: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 16px !important;
}


/* =============================================================================
   TAB
   ============================================================================= */

.aba-com-scroll {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

    .aba-com-scroll .mud-tabs-panels {
        flex: 1;
        overflow-y: auto;
        overflow-x: hidden;
        padding-right: 4px;
        min-height: 0;
    }

/* =============================================================================
   CUSTOM DATA GRID & COLUNAS RESPONSIVAS
   ============================================================================= */
.custom-grid {
    height: 100%;
    display: flex;
    flex-direction: column;
    border-top: none !important;
}

    .custom-grid .mud-table-container {
        flex-grow: 1;
        overflow-y: auto;
        border-bottom: none !important;
        box-shadow: none !important;
    }

.no-toolbar .mud-table-toolbar {
    display: none !important;
}

.flex-none {
    flex: none;
}

.custom-grid .mud-table-body tr:last-child td {
    border-bottom: none !important;
}

.mud-table-toolbar {
    display: flex !important;
    align-items: center !important;
    min-height: 48px;
    padding: 0 16px;
}

    .mud-table-toolbar > * {
        display: flex;
        align-items: center;
    }

.mud-table-pagination {
    overflow: hidden !important;
    max-height: 52px;
}

.mud-table-pagination-display .mud-input-control {
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

@media (max-width: 600px) {
    .custom-grid .mud-table-root {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    .css-coluna-responsiva {
        width: auto !important;
        min-width: 100px !important;
    }
}

@media (min-width: 601px) {
    .css-coluna-responsiva {
        width: var(--col-width) !important;
        min-width: var(--col-width) !important;
    }
}

/* =============================================================================
   RODAPÉ DO SISTEMA
   ============================================================================= */
.footer-bar {
    height: 30px;
    padding: 8px 16px;
    background-color: #1f3447;
    color: white;
    text-align: center;
}

.footer-fixed {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
}

/* =============================================================================
   DIVERSOS & ALINHAMENTOS
   ============================================================================= */
.menuAppBar-borda-inferior {
    border-bottom: solid 2px var(--mud-palette-primary);
}

.align-left {
    text-align: left;
}

.align-center {
    text-align: center;
}

.align-right {
    text-align: right;
}

.align-middle {
    vertical-align: middle;
}

/* Estilos de linha e estados */
.row-add-icon {
    color: green;
    cursor: pointer;
}

.row-select-icon {
    color: green;
    cursor: pointer;
}

.row-edit-icon {
    color: orange;
    cursor: pointer;
}

.row-delete-icon {
    color: red;
    cursor: pointer;
}

.row-deleted {
    text-decoration: line-through;
    color: #777;
    opacity: 0.7;
}

.row-delete-cancelled-icon {
    color: gray;
    opacity: 0.6;
    cursor: not-allowed;
}

/* Tipografia e Quebra de linha */
.nowrap {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.breakline {
    white-space: normal;
    word-wrap: break-word;
    word-break: break-word;
    overflow: visible;
    text-overflow: clip;
}


/* =============================================================================
   COMPONENTE DE UPLOAD
   ============================================================================= */
.file-upload-no-chip .mud-input-control-input-container {
    display: flex !important;
    align-items: center !important;
}

.file-upload-no-chip .mud-file-upload-files {
    display: none !important;
}


/* =============================================================================
   VALIDAÇÃO EM FORMULÁRIO
   ============================================================================= */
.validation-message {
    color: #e53935;
    font-size: 0.85rem;
    margin-top: 4px;
    font-weight: 500;
    padding-left: 20px;
    position: relative;
    display: block;
}

    .validation-message::before {
        content: "⚠️";
        position: absolute;
        left: 0;
        top: 0;
    }

.validation-space {
    min-height: 1.5em;
    display: block;
}

/* =============================================================================
   JSON VIEWER FORMAT
   ============================================================================= */
.json-viewer {
    background: #2e3440;
    color: #d8dee9;
    padding: 6px 8px;
    border-radius: 4px;
    font-family: Consolas, monospace;
    font-size: 0.9rem;
    line-height: 1.2em;
    white-space: pre-wrap;
    overflow-x: auto;
    max-height: 200px;
}

    .json-viewer .key {
        color: #88c0d0;
        font-weight: bold;
    }

    .json-viewer .string {
        color: #a3be8c;
    }

    .json-viewer .number {
        color: #b48ead;
    }

    .json-viewer .boolean {
        color: #ebcb8b;
        font-weight: bold;
    }

    .json-viewer .null {
        color: #bf616a;
        font-style: italic;
    }

/* =============================================================================
   POPOVERS RESPONSIVOS
   ============================================================================= */
.popover-responsivo-600 {
    min-width: 600px !important;
    max-width: 700px !important;
    transition: min-width 0.3s ease;
}

.popover-responsivo-500 {
    min-width: 500px !important;
    max-width: 600px !important;
    transition: min-width 0.3s ease;
}

.popover-responsivo-400 {
    min-width: 400px !important;
    max-width: 500px !important;
    transition: min-width 0.3s ease;
}

.popover-responsivo-300 {
    min-width: 300px !important;
    max-width: 400px !important;
    transition: min-width 0.3s ease;
}

.popover-responsivo-200 {
    min-width: 200px !important;
    max-width: 300px !important;
    transition: min-width 0.3s ease;
}

@media (max-width: 960px) {
    [class*="popover-responsivo-"] {
        min-width: 80% !important;
        max-width: 90% !important;
    }
}

@media (max-width: 600px) {
    [class*="popover-responsivo-"] {
        min-width: 100% !important;
        max-width: 100% !important;
    }
}

/* =============================================================================
   LOADERS & SPINNERS
   ============================================================================= */
.progress-container {
    height: 4px;
    transition: opacity 0.3s ease;
}

.progress-hidden {
    opacity: 0;
    pointer-events: none;
}

.progress-visible {
    opacity: 1;
}

.loader {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2;
    opacity: 1;
    transition: opacity 0.45s ease;
}

    .loader.hidden {
        opacity: 0;
        pointer-events: none;
    }

/* Animações de Pulsação */
@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0.7);
    }

    50% {
        box-shadow: 0 0 0 10px rgba(244, 67, 54, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(244, 67, 54, 0);
    }
}

@keyframes pulse-orange {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(255, 152, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(255, 152, 0, 0);
    }
}

.pulse-error {
    animation: pulse-red 1.5s infinite;
    border-radius: 16px;
}

.pulse-warning {
    animation: pulse-orange 3s infinite;
    border-radius: 16px;
}

/* =============================================================================
   SIDEBAR & MENUS INTERNOS
   ============================================================================= */
.sidebar-menu {
    padding: 8px 0;
    font-family: Roboto, sans-serif;
    font-size: 13px;
}

.mod-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px 8px;
    cursor: pointer;
    user-select: none;
}

    .mod-header:hover {
        background: #f5f5f5;
    }

.mod-icon, .mod-arrow {
    color: #14467e !important;
    font-size: 18px !important;
}

.mod-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: #14467e;
    flex: 1;
}

.mod-body {
    padding-bottom: 6px;
}

.mod-divider {
    height: 0.5px;
    background: #f0f0f0;
}

.grp-divider {
    height: 0.5px;
    background: #f5f5f5;
    margin: 2px 0;
}

.group-header {
    display: flex;
    align-items: center;
    padding: 7px 16px 4px 24px;
    cursor: pointer;
    user-select: none;
    opacity: 1 !important;
}

.group-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #757575;
    flex: 1;
}

.group-arrow {
    color: #bdbdbd !important;
    font-size: 16px !important;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 16px 7px 36px;
    cursor: pointer;
    color: #424242;
    position: relative;
    transition: background 0.15s;
}

.group-body .nav-item {
    padding-left: 48px;
}

.nav-item:hover {
    background: #e8f0fa;
    color: #14467e;
}

    .nav-item:hover .nav-icon {
        color: #14467e !important;
    }

.nav-item.active {
    background: #ddeaf7;
    color: #14467e;
    font-weight: 500;
}

    .nav-item.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 3px;
        background: #14467e;
    }

    .nav-item.active .nav-icon {
        color: #14467e !important;
    }

.nav-item.disabled {
    opacity: 0.45;
    cursor: default;
    pointer-events: none;
}

.nav-icon {
    color: #9e9e9e !important;
    font-size: 16px !important;
    flex-shrink: 0;
}

.nav-label {
    flex: 1;
}

.nav-badge {
    font-size: 10px;
    color: #bdbdbd;
    font-style: italic;
}

/* Busca na Sidebar */
.sidebar-search {
    padding: 10px 12px 6px;
    border-bottom: 0.5px solid #f0f0f0;
    position: relative;
}

.search-popup {
    position: absolute;
    top: calc(100% - 4px);
    left: 8px;
    right: 8px;
    background: #ffffff;
    border: 0.5px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
    z-index: 9999;
    max-height: 320px;
    overflow-y: auto;
}

.search-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    border-bottom: 0.5px solid #f5f5f5;
}

    .search-item:hover {
        background: #e8f0fa;
    }

    .search-item:last-child {
        border-bottom: none;
    }

    .search-item.disabled {
        opacity: 0.45;
        cursor: default;
        pointer-events: none;
    }

.search-item-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.search-item-label {
    font-size: 13px;
    color: #212121;
}

.search-item-group {
    font-size: 10px;
    color: #9e9e9e;
    margin-top: 1px;
}

.search-empty {
    padding: 16px;
    text-align: center;
    font-size: 13px;
    color: #9e9e9e;
}
