/**
 * Contabil - Modern Components Library
 * Componentes visuais estilo TradingView/Grok
 * Glassmorphism, Neon Effects, Cards Modernos
 * Versão 1.0 - Feb 2026
 */

/* ========================================
   MODERN CARDS - GLASSMORPHISM
   ======================================== */

/* Card base moderno */
.modern-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-backdrop);
    -webkit-backdrop-filter: var(--glass-backdrop);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.modern-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
    border-color: var(--accent-purple);
}

.modern-card:hover::before {
    opacity: 1;
}

/* KPI Cards estilo TradingView */
.kpi-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: radial-gradient(circle, var(--accent-purple-light) 0%, transparent 70%);
    opacity: 0.3;
    transition: all 0.3s ease;
}

.kpi-card:hover::after {
    opacity: 0.6;
    transform: scale(1.5);
}

.kpi-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.kpi-card-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    position: relative;
    z-index: 1;
}

.kpi-card-icon.purple {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: white;
}

.kpi-card-icon.green {
    background: linear-gradient(135deg, var(--accent-mint), var(--accent-blue));
    color: white;
}

.kpi-card-icon.red {
    background: linear-gradient(135deg, var(--accent-salmon), var(--accent-amber));
    color: white;
}

.kpi-card-icon.blue {
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-purple));
    color: white;
}

.kpi-card-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.kpi-card-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.kpi-card-trend {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
}

.kpi-card-trend.up {
    background: var(--accent-mint-light);
    color: var(--accent-mint-dark);
}

.kpi-card-trend.down {
    background: var(--accent-salmon-light);
    color: var(--accent-salmon-dark);
}

/* ========================================
   CHART CONTAINERS - TRADINGVIEW STYLE
   ======================================== */

.chart-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: var(--shadow-glow-blue);
    border-color: var(--accent-blue);
}

.chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-light);
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-title i {
    color: var(--accent-purple);
}

.chart-actions {
    display: flex;
    gap: 0.5rem;
}

.chart-action-btn {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-light);
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chart-action-btn:hover {
    background: var(--bg-hover);
    color: var(--accent-purple);
    border-color: var(--accent-purple);
}

.chart-container {
    position: relative;
    min-height: 300px;
}

/* ========================================
   TABLES - MODERN STYLE
   ======================================== */

.modern-table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-light);
}

.modern-table {
    width: 100%;
    border-collapse: collapse;
}

.modern-table thead {
    background: var(--bg-hover);
}

.modern-table th {
    padding: 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 1px solid var(--border-light);
}

.modern-table td {
    padding: 1rem;
    color: var(--text-primary);
    border-bottom: 1px solid var(--border-light);
}

.modern-table tbody tr {
    transition: background-color 0.2s ease;
}

.modern-table tbody tr:hover {
    background: var(--bg-hover);
}

.modern-table tbody tr:last-child td {
    border-bottom: none;
}

/* ========================================
   BADGES - MODERN STATUS
   ======================================== */

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.status-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}

.status-badge.success {
    background: var(--accent-mint-light);
    color: var(--accent-mint-dark);
}

.status-badge.warning {
    background: var(--accent-amber-light);
    color: var(--accent-amber-dark);
}

.status-badge.danger {
    background: var(--accent-salmon-light);
    color: var(--accent-salmon-dark);
}

.status-badge.info {
    background: var(--accent-blue-light);
    color: var(--accent-blue-dark);
}

.status-badge.purple {
    background: var(--accent-purple-light);
    color: var(--accent-purple-dark);
}

/* ========================================
   BUTTONS - MODERN STYLE
   ======================================== */

.modern-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.modern-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.modern-btn:active::before {
    width: 300px;
    height: 300px;
}

.modern-btn.primary {
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-blue));
    color: white;
    box-shadow: var(--shadow-button);
}

.modern-btn.primary:hover {
    box-shadow: var(--shadow-glow-purple);
    transform: translateY(-2px);
}

.modern-btn.outline {
    background: transparent;
    border: 2px solid var(--accent-purple);
    color: var(--accent-purple);
}

.modern-btn.outline:hover {
    background: var(--accent-purple);
    color: white;
}

.modern-btn.ghost {
    background: transparent;
    color: var(--text-primary);
}

.modern-btn.ghost:hover {
    background: var(--bg-hover);
}

/* ========================================
   INPUTS - MODERN STYLE
   ======================================== */

.modern-input-group {
    margin-bottom: 1.5rem;
}

.modern-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.modern-input {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border-light);
    background: var(--bg-input);
    color: var(--text-primary);
    font-size: 0.875rem;
    transition: all 0.3s ease;
}

.modern-input:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px var(--accent-purple-light);
}

.modern-input::placeholder {
    color: var(--text-muted);
}

/* Input com ícone */
.modern-input-icon {
    position: relative;
}

.modern-input-icon i {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
}

.modern-input-icon .modern-input {
    padding-left: 2.75rem;
}

/* ========================================
   MODALS - GLASSMORPHISM
   ======================================== */

.modern-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-overlay);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modern-modal {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-dropdown);
    border: 1px solid var(--border-light);
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: scaleIn 0.3s ease;
}

.modern-modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modern-modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.modern-modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: transparent;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.modern-modal-close:hover {
    background: var(--bg-hover);
    color: var(--accent-salmon);
}

.modern-modal-body {
    padding: 1.5rem;
}

.modern-modal-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
}

/* ========================================
   TOOLTIPS - MODERN STYLE
   ======================================== */

.modern-tooltip {
    position: relative;
    display: inline-block;
}

.modern-tooltip::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    padding: 0.5rem 0.75rem;
    background: var(--bg-sidebar);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    white-space: nowrap;
    box-shadow: var(--shadow-dropdown);
    border: 1px solid var(--border-light);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 9999;
}

.modern-tooltip::after {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--bg-sidebar);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 9999;
}

.modern-tooltip:hover::before,
.modern-tooltip:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========================================
   PROGRESS BARS - MODERN STYLE
   ======================================== */

.modern-progress {
    width: 100%;
    height: 8px;
    background: var(--bg-hover);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.modern-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
    border-radius: var(--radius-full);
    transition: width 0.6s ease;
    position: relative;
    overflow: hidden;
}

.modern-progress-bar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.3),
        transparent
    );
    animation: shimmer 2s infinite;
}

/* ========================================
   DIVIDERS - MODERN STYLE
   ======================================== */

.modern-divider {
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--border-light),
        transparent
    );
    margin: 2rem 0;
}

.modern-divider.with-text {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin: 2rem 0;
}

.modern-divider.with-text::before,
.modern-divider.with-text::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        var(--border-light),
        transparent
    );
}

.modern-divider-text {
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ========================================
   RESPONSIVE ADJUSTMENTS
   ======================================== */

@media (max-width: 768px) {
    .kpi-card-value {
        font-size: 1.5rem;
    }
    
    .modern-modal {
        width: 95%;
    }
    
    .chart-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
}
