/* Estilos Customizados Premium para Contato Print ERP */

/* Variáveis de Cores e Estilo */
:root {
    --primary-color: #142976;
    --primary-hover: #0f205c;
    --primary-light: #ebf0ff;
    --primary-gradient: linear-gradient(135deg, #142976 0%, #1e3d9e 100%);
    --bg-dark: #090d1f;
    --bg-card: rgba(255, 255, 255, 0.07);
    --border-card: rgba(255, 255, 255, 0.12);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #38bdf8;
    --success-color: #4ade80;
    --danger-color: #f87171;
    --warning-color: #fbbf24;
}

/* Reset e Configurações Gerais */
body {
    background-color: var(--bg-dark);
    background-image: radial-gradient(circle at 10% 20%, rgba(20, 41, 118, 0.15) 0%, transparent 40%),
                      radial-gradient(circle at 90% 80%, rgba(30, 61, 158, 0.12) 0%, transparent 40%);
    background-attachment: fixed;
    color: var(--text-primary);
    font-family: 'Outfit', 'Inter', system-ui, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Topbar Mobile */
.mobile-topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 58px;
    background: rgba(9, 13, 31, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border-card);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 1030;
}

.mobile-brand {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: -0.3px;
}

.mobile-brand span {
    color: var(--accent-color);
}

.btn-mobile-toggle {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid var(--border-card);
    color: #ffffff;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.btn-mobile-toggle:hover,
.btn-mobile-toggle:focus {
    background: var(--primary-gradient);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Sidebar Backdrop no Mobile */
.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(4, 7, 20, 0.78);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1045;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
}

body.sidebar-open .sidebar-backdrop,
.sidebar-backdrop.active {
    opacity: 1;
    visibility: visible;
}

body.sidebar-open {
    overflow: hidden !important;
}

/* Sidebar Estilo Premium */
.sidebar {
    background: linear-gradient(180deg, #101c4f 0%, #080e2d 100%);
    border-right: 1px solid var(--border-card);
    height: 100vh;
    max-height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    z-index: 1040;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
    overflow-y: auto;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}

/* Custom Scrollbar para Sidebar */
.sidebar::-webkit-scrollbar {
    width: 4px;
}
.sidebar::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}
.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.4);
}

.sidebar .nav-link {
    color: var(--text-secondary);
    padding: 0.45rem 0.85rem;
    font-weight: 500;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 10px;
    border-radius: 6px;
    margin: 0.12rem 0.6rem;
    transition: all 0.2s ease;
}

.sidebar .nav-link i {
    font-size: 1rem;
}

.sidebar .nav-link:hover, 
.sidebar .nav-link.active {
    color: #ffffff;
    background: var(--primary-gradient);
    box-shadow: 0 4px 15px rgba(20, 41, 118, 0.4);
}

.sidebar-logo {
    font-size: 1.15rem;
    font-weight: 700;
    color: #ffffff;
    padding: 0 1rem 0.6rem 1rem;
    border-bottom: 1px solid var(--border-card);
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.sidebar-logo span {
    color: var(--accent-color);
}

/* Conteúdo Principal */
.main-content {
    min-height: 100vh;
    transition: all 0.2s ease;
}

/* Dispositivos Desktop (>= 768px) */
@media (min-width: 768px) {
    .mobile-topbar {
        display: none !important;
    }
    .sidebar-backdrop {
        display: none !important;
    }
    .sidebar {
        display: block !important;
        transform: none !important;
        visibility: visible !important;
        width: 260px;
    }
    .main-content {
        margin-left: 260px !important;
        width: calc(100% - 260px) !important;
        padding: 2rem;
    }
}

/* Dispositivos Mobile (< 768px) */
@media (max-width: 767.98px) {
    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 280px !important;
        max-width: 85vw !important;
        height: 100vh !important;
        z-index: 1050 !important;
        transform: translateX(-100%);
        visibility: hidden;
        display: block !important;
        box-shadow: none;
    }
    .sidebar.show {
        transform: translateX(0) !important;
        visibility: visible !important;
        box-shadow: 10px 0 40px rgba(0, 0, 0, 0.8) !important;
    }
    .sidebar.collapsing {
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) !important;
        height: 100vh !important;
    }
    .main-content {
        margin-left: 0 !important;
        width: 100% !important;
        max-width: 100vw !important;
        padding: 1.15rem 0.85rem !important;
        min-height: calc(100vh - 58px);
        overflow-x: hidden;
    }
    /* Headers de páginas */
    .main-content-header {
        flex-direction: column;
        align-items: flex-start !important;
        gap: 0.75rem;
        padding-top: 0.25rem !important;
        margin-bottom: 1.25rem !important;
    }
    .main-content-header h1.h2,
    .main-content-header .h2 {
        font-size: 1.35rem !important;
        margin-bottom: 0 !important;
        margin-left: 0 !important;
    }
    .main-content-header .btn-toolbar {
        width: 100%;
    }
    .main-content-header .btn-toolbar .btn,
    .main-content-header .btn-toolbar .btn-group {
        width: 100%;
        margin-right: 0 !important;
    }
    .main-content-header .btn-toolbar .btn {
        display: flex;
        justify-content: center;
        align-items: center;
    }
}

/* Cards com Glassmorphism */
.card-glass {
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    color: var(--text-primary);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card-glass:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px 0 rgba(20, 41, 118, 0.25);
    border-color: rgba(255, 255, 255, 0.2);
}

.card-header-glass {
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-card);
    padding: 1.2rem 1.5rem;
    border-top-left-radius: 16px !important;
    border-top-right-radius: 16px !important;
}

/* Tabelas Premium */
.table-responsive-glass {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--border-card);
}

.table-glass {
    background: rgba(255, 255, 255, 0.02);
    margin-bottom: 0;
    color: var(--text-primary);
}

.table-glass th {
    background: rgba(20, 41, 118, 0.5) !important;
    color: #ffffff !important;
    font-weight: 600;
    border-bottom: 2px solid var(--border-card) !important;
    padding: 1rem;
}

.table-glass td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid var(--border-card);
    background: transparent !important;
    color: var(--text-primary);
}

.table-glass tr:hover td {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Inputs de Formulários Premium */
.form-control-glass {
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid var(--border-card) !important;
    color: #ffffff !important;
    border-radius: 8px;
    padding: 0.65rem 1rem;
    transition: all 0.2s ease;
}

.form-control-glass:focus {
    background: rgba(255, 255, 255, 0.08) !important;
    border-color: var(--accent-color) !important;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.25) !important;
}

.form-control-glass::placeholder {
    color: var(--text-secondary);
}

/* Opções de menus de seleção (dropdowns / select) */
.form-control-glass option,
select.form-select option,
select option {
    color: #334155 !important;
    background-color: #ffffff !important;
}

.form-label-glass {
    color: var(--text-primary);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

/* Botões Customizados */
.btn-premium {
    background: var(--primary-gradient);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(20, 41, 118, 0.3);
}

.btn-premium:hover {
    background: linear-gradient(135deg, #1e3d9e 0%, #2a52cf 100%);
    color: #ffffff;
    box-shadow: 0 6px 20px rgba(30, 61, 158, 0.5);
    transform: translateY(-1px);
}

.btn-glass-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 0.65rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
}

.btn-glass-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.3);
}

/* Kanban Board */
.kanban-board {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    padding-bottom: 1.25rem;
}

.kanban-column {
    flex: 0 0 290px;
    min-width: 290px;
    max-width: 85vw;
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-card);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.kanban-column-header {
    font-weight: 600;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border-card);
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.kanban-cards-container {
    min-height: 250px;
    border-radius: 8px;
    padding: 4px;
    transition: all 0.2s ease;
}

.kanban-column.drag-over,
.kanban-cards-container.drag-over {
    background: rgba(56, 189, 248, 0.08) !important;
    border: 1px dashed rgba(56, 189, 248, 0.6) !important;
    border-radius: 12px;
}

.kanban-card {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--border-card);
    border-radius: 8px;
    padding: 0.8rem;
    cursor: grab;
    user-select: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.kanban-card:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

.kanban-card:active {
    cursor: grabbing;
}

.kanban-card.dragging {
    opacity: 0.45 !important;
    transform: scale(0.98);
    border: 2px dashed var(--accent-color, #38bdf8) !important;
    cursor: grabbing !important;
}

.kanban-card.status-updating {
    pointer-events: none;
}

/* Badges de Status */
.badge-status {
    padding: 0.4rem 0.75rem;
    border-radius: 30px;
    font-size: 0.8rem;
    font-weight: 600;
}

.badge-pending { background-color: rgba(251, 191, 36, 0.15); color: var(--warning-color); border: 1px solid rgba(251, 191, 36, 0.3); }
.badge-success { background-color: rgba(74, 222, 128, 0.15); color: var(--success-color); border: 1px solid rgba(74, 222, 128, 0.3); }
.badge-danger { background-color: rgba(248, 113, 113, 0.15); color: var(--danger-color); border: 1px solid rgba(248, 113, 113, 0.3); }
.badge-info { background-color: rgba(56, 189, 248, 0.15); color: var(--accent-color); border: 1px solid rgba(56, 189, 248, 0.3); }

/* Estilização da Tela de Login */
.login-container {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.login-box {
    width: 100%;
    max-width: 420px;
    padding: 2.5rem;
}

/* Ajustes Adicionais para Mobile (< 768px) */
@media (max-width: 767.98px) {
    .login-box {
        margin: 0.5rem auto;
        padding: 1.75rem 1.25rem !important;
        border-radius: 14px;
    }

    .card-glass {
        border-radius: 14px;
    }

    .card-glass.p-4 {
        padding: 1.2rem 1rem !important;
    }

    .card-header-glass {
        padding: 0.85rem 1rem !important;
    }

    .card-glass h3 {
        font-size: 1.35rem !important;
    }

    /* Tabelas com rolagem suave no mobile */
    .table-glass {
        min-width: 580px;
    }
    .table-glass th,
    .table-glass td {
        white-space: nowrap;
        padding: 0.75rem 0.85rem;
        font-size: 0.85rem;
    }

    /* Tabs Horizontais com Rolagem Suave */
    .nav-tabs {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        white-space: nowrap !important;
        scrollbar-width: none;
    }
    .nav-tabs::-webkit-scrollbar {
        display: none;
    }
    .nav-tabs .nav-link {
        flex-shrink: 0 !important;
        font-size: 0.85rem;
        padding: 0.5rem 0.85rem;
    }

    /* Modal no Mobile */
    .modal-dialog {
        margin: 0.75rem;
    }
}

/* Modais com Z-Index e Stacking Context Garantidos */
.modal {
    z-index: 1060 !important;
}
.modal-backdrop {
    z-index: 1050 !important;
}
.modal-content {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

/* Estilo para Impressão de PDF */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    .sidebar, .btn, .main-content-header, .mobile-topbar, .sidebar-backdrop {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    .card-glass {
        border: none !important;
        box-shadow: none !important;
        background: transparent !important;
    }
}