/**
 * ⚠️ PARTIALLY DEPRECATED - Premium Components CSS (Legado)
 * ========================================
 * 
 * Este arquivo continha componentes premium que foram MIGRADOS para arquitetura modular:
 * 
 * ✅ COMPONENTES JÁ MIGRADOS (NÃO EDITAR AQUI):
 * - Fullscreen Table Modal → assets/css/3-components/tables.css
 * - Service Tabs Premium → assets/css/3-components/buttons.css
 * - Alert Cards → assets/css/3-components/cards.css
 * - Form Controls → assets/css/3-components/forms.css
 * 
 * 📦 NOVA ARQUITETURA MODULAR:
 * Foundation → Base → Components → Features → Utilities
 * 
 * ⚙️ AINDA ATIVO (Componentes únicos não modulares):
 * - Data Table Premium (redimensionamento de colunas)
 * - Table Controls (filtros e ordenação)
 * - Loading & Error States
 * - Performance Optimizations
 * 
 * 📝 STATUS: Mantido para componentes específicos de tabela.
 * 🎯 AÇÃO FUTURA: Integrar componentes restantes em tables.css após refatoração.
 * 
 * @deprecated Parcialmente - Use arquivos modulares para novos componentes
 * @author Dashboard Premium V3
 * @created 2025-10-01
 * @modified 2025-01-09 (Adicionado aviso de deprecação parcial)
 * @source dashboard-premium.html (5016 linhas)
 */

/* ========================================
   DATA TABLE PREMIUM - Redimensionável
   ======================================== */

/* Table Container */
.data-table {
    table-layout: auto;
    width: 100%;
    min-width: 800px;
}

.data-table-container {
    position: relative;
    overflow-x: auto;
    resize: horizontal;
    min-width: 100%;
}

/* Headers Redimensionáveis */
.data-table thead th {
    position: relative;
    min-width: 50px !important;
    max-width: 400px;
    resize: horizontal;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Handle de Redimensionamento Visual */
.data-table thead th::before {
    content: '';
    position: absolute;
    top: 0;
    right: -2px;
    width: 4px;
    height: 100%;
    background: transparent;
    cursor: col-resize;
    transition: all var(--transition-base);
    opacity: 0;
    z-index: 5;
}

.data-table thead th:hover::before {
    opacity: 1;
    background: rgba(0, 191, 255, 0.5);
    box-shadow: 0 0 8px rgba(0, 191, 255, 0.3);
}

/* Estado de Redimensionamento Ativo */
.data-table thead th.resizing::before {
    opacity: 1;
    background: var(--primary-color);
    box-shadow: 0 0 12px rgba(0, 191, 255, 0.6);
}

/* Células com Quebra de Texto Inteligente */
.data-table td,
.data-table th {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    min-width: 30px !important;
    position: relative;
}

/* Tooltip para Texto Truncado */
.data-table td[title],
.data-table th[title] {
    cursor: help;
}

.data-table td:hover,
.data-table th:hover {
    position: relative;
    z-index: 10;
}

/* Larguras Padrão Otimizadas por Coluna */
.data-table th:nth-child(1) { width: 25%; min-width: 60px !important; } /* Empresa/Nome */
.data-table th:nth-child(2) { width: 20%; min-width: 50px !important; } /* Produto/Serviço */
.data-table th:nth-child(3) { width: 12%; min-width: 40px !important; }  /* Total */
.data-table th:nth-child(4) { width: 15%; min-width: 50px !important; }  /* Consumidas */
.data-table th:nth-child(5) { width: 15%; min-width: 50px !important; }  /* Disponíveis */
.data-table th:nth-child(6) { width: 13%; min-width: 40px !important; }  /* Percentual */

/* Container Inteligente com Indicadores */
.table-wrapper {
    position: relative;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(10px);
    padding: 2px;
    margin: var(--space-md) 0;
    overflow: hidden;
}

/* Indicador de Scroll Horizontal */
.table-scroll-indicator {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 60px;
    background: linear-gradient(90deg, transparent, rgba(0, 191, 255, 0.3));
    border-radius: 10px 0 0 10px;
    opacity: 0;
    transition: opacity var(--transition-base);
    pointer-events: none;
}

.data-table-container:hover .table-scroll-indicator {
    opacity: 1;
}

/* Tooltip para Redimensionamento */
.resize-tooltip {
    position: absolute;
    top: -35px;
    right: 10px; /* 🔧 FIX: Movido mais para dentro para não conflitar */
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    z-index: 100;
    transition: opacity 0.3s ease;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}

/* 🔧 FIX: Só mostra tooltip quando mouse está na borda direita do header */
.data-table thead th:hover .resize-tooltip {
    opacity: 0; /* Desabilitado por padrão */
}

/* 🔧 FIX: Cursor col-resize nas bordas dos headers */
.data-table thead th {
    position: relative;
    cursor: pointer; /* Click para ordenar */
}

.data-table thead th::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 10px; /* Área de resize */
    cursor: col-resize; /* 🔧 Cursor de resize apenas na borda */
}

/* ========================================
   TABLE CONTROLS - Filtros e Ordenação
   ======================================== */

.table-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 20px;
    padding: 15px;
    background: rgba(15, 23, 42, 0.8);
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
}

#table-filter, 
#sort-column, 
#sort-order {
    background: rgba(15, 23, 42, 0.95);
    border: 2px solid rgba(59, 130, 246, 0.4);
    border-radius: 6px;
    padding: 8px 12px;
    color: #ffffff;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

#table-filter:hover, 
#sort-column:hover, 
#sort-order:hover {
    border-color: rgba(59, 130, 246, 0.6);
    background: rgba(15, 23, 42, 1);
}

#table-filter:focus, 
#sort-column:focus, 
#sort-order:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

#table-filter::placeholder {
    color: #94a3b8;
}

/* Estilos específicos para as options dos selects */
#sort-column option, 
#sort-order option {
    background: #0f172a !important;
    color: #ffffff !important;
    padding: 8px 12px;
    font-weight: 500;
    border: none;
}

#sort-column option:checked, 
#sort-order option:checked {
    background: rgba(59, 130, 246, 0.3) !important;
    color: #ffffff !important;
}

#sort-column option:hover, 
#sort-order option:hover {
    background: rgba(59, 130, 246, 0.2) !important;
    color: #ffffff !important;
}

/* Forçar contraste para todos os navegadores */
select#sort-column, 
select#sort-order {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Webkit (Chrome, Safari) específico */
select#sort-column option, 
select#sort-order option {
    background-color: #0f172a !important;
    color: #ffffff !important;
}

/* Firefox específico */
@-moz-document url-prefix() {
    select#sort-column option, 
    select#sort-order option {
        background-color: #0f172a !important;
        color: #ffffff !important;
    }
}

/* Checkbox de Filtro */
#hide-free-licenses {
    accent-color: #3b82f6;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.form-group label {
    font-size: 0.9em;
    color: #94a3b8;
    transition: color 0.2s ease;
}

.form-group label:hover {
    color: #e2e8f0;
}

/* ========================================
   LOADING & ERROR STATES
   ======================================== */

.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.error {
    color: var(--danger-color);
    background: rgba(239, 68, 68, 0.1);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--danger-color);
    margin: 10px 0;
}

/* Alert Message Toast */
.alert-message {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 15px 20px;
    border-radius: 8px;
    color: white;
    z-index: var(--z-toast);
    max-width: 400px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform: translateX(100%);
    transition: transform 0.3s ease;
}

.alert-message.show {
    transform: translateX(0);
}

/* ========================================
   PERFORMANCE OPTIMIZATIONS
   ======================================== */

/* GPU Acceleration & Compositing Layers */
.summary-card,
.service-tab,
.btn,
.data-table tbody tr {
    will-change: transform;
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

/* Contain Layout Thrashing */
.summary-cards,
.service-tabs,
.data-table {
    contain: layout style paint;
}

/* Optimize Repaints */
.summary-card::before,
.summary-card::after,
.service-tab::before,
.btn::before {
    content: '';
    position: absolute;
    pointer-events: none;
    will-change: opacity, transform;
}

/* Critical Rendering Path Optimization */
.container {
    contain: layout;
    isolation: isolate;
}

/* Reduce Layout Calculations */
.header {
    contain: layout style;
}

/* Optimize Animations */
.summary-card:hover,
.service-tab:hover,
.btn:hover {
    contain: layout;
}

/* Memory Management */
.alert-card,
.alert-stat-card {
    contain: style paint;
}

/* Subpixel Rendering Optimization */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* Scroll Performance */
.data-table-container {
    contain: strict;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

/* Optimize Gradients */
.header {
    background-attachment: fixed;
    background-repeat: no-repeat;
    background-size: cover;
}

/* Hardware Acceleration Hints */
.float-animation {
    transform: translate3d(0, 0, 0);
    will-change: transform;
}

/* Critical Performance Hints */
.summary-card:hover {
    transform: translate3d(0, -2px, 0) scale(1.02);
}

.service-tab.active {
    transform: translate3d(0, 0, 0);
}

.btn:active {
    transform: translate3d(0, 1px, 0) scale(0.98);
}

/* Memory Efficient Selectors */
[class*="summary-"],
[class*="service-"],
[class*="alert-"] {
    box-sizing: border-box;
}

/* Optimize Repaint Regions */
.controls-section,
.summary-cards,
.alert-stats-grid {
    isolation: isolate;
}

/* Performance Critical Animations */
@keyframes optimized-float {
    0%, 100% { 
        transform: translate3d(0, 0, 0); 
    }
    50% { 
        transform: translate3d(0, -4px, 0); 
    }
}

/* Batch DOM Updates */
.container > * {
    contain: layout style;
}

/* Final Performance Boost */
body {
    contain: layout style paint;
    text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
}
