/* 🎨 MerchantGuard UI Enhancements - Professional & Mobile-Ready */

/* ==================== GLASSMORPHISM EFFECTS ==================== */
.card, .panel, .metric-card, .stat-card {
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(255, 255, 255, 0.05) !important;
    border: 1px solid rgba(255, 255, 255, 0.125);
    box-shadow: 0 8px 32px 0 rgba(0, 204, 102, 0.15);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card:hover, .panel:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 40px 0 rgba(0, 204, 102, 0.25);
    background: rgba(255, 255, 255, 0.08) !important;
}

/* ==================== PROFESSIONAL BUTTON IMPROVEMENTS ==================== */
.insight-cta, .nav-tab, .scenario-button {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.insight-cta:hover, .nav-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.insight-cta:active, .nav-tab:active {
    transform: translateY(0);
    transition: all 0.1s;
}

/* Loading state for buttons */
.button-loading {
    pointer-events: none;
    opacity: 0.7;
}

.button-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: button-spin 1s linear infinite;
}

@keyframes button-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Professional select replacement */
.brand-selector {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 12px 16px;
    color: white;
    font-size: 14px;
    transition: all 0.2s;
    cursor: pointer;
}

.brand-selector:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.brand-selector:focus {
    outline: none;
    border-color: rgba(76, 184, 196, 0.8);
    box-shadow: 0 0 0 2px rgba(76, 184, 196, 0.2);
}

/* Scenario button improvements */
.nav-tab.stress {
    position: relative;
}

.nav-tab.stress::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, #ff6b6b, #ffa500);
    border-radius: inherit;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s;
}

.nav-tab.stress:hover::before {
    opacity: 1;
}

/* ==================== SMOOTH ANIMATIONS ==================== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}

@keyframes pulse {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
    100% { transform: scale(1); opacity: 1; }
}

.hero-section, .dashboard-section {
    animation: fadeInUp 0.8s ease-out;
}

.metric-card {
    animation: fadeInUp 0.8s ease-out;
    animation-fill-mode: both;
}

.metric-card:nth-child(1) { animation-delay: 0.1s; }
.metric-card:nth-child(2) { animation-delay: 0.2s; }
.metric-card:nth-child(3) { animation-delay: 0.3s; }
.metric-card:nth-child(4) { animation-delay: 0.4s; }

/* ==================== LOADING STATES ==================== */
.skeleton {
    background: linear-gradient(90deg, 
        rgba(255,255,255,0.05) 0%, 
        rgba(255,255,255,0.1) 50%, 
        rgba(255,255,255,0.05) 100%);
    background-size: 1000px 100%;
    animation: shimmer 2s infinite;
    border-radius: 8px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--primary-green);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== ENHANCED BUTTONS ==================== */
button, .btn, .cta-button {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    min-height: 44px; /* Touch-friendly */
    touch-action: manipulation;
}

button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:active::before {
    width: 300px;
    height: 300px;
}

/* ==================== MOBILE OPTIMIZATIONS ==================== */
@media (max-width: 768px) {
    /* Improved mobile navigation */
    .header {
        padding: 15px;
        position: sticky;
        top: 0;
        z-index: 1000;
    }
    
    .header-content {
        flex-wrap: wrap;
        gap: 15px;
    }
    
    /* Touch-friendly spacing */
    .metric-card, .stat-card {
        padding: 20px;
        margin-bottom: 15px;
        min-height: 120px;
    }
    
    /* Responsive grid */
    .metrics-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Mobile-optimized modals */
    #dualSaltModal > div,
    #guardScoreModal > div,
    #methodologyModal > div,
    #tokenizationModal > div {
        width: 95% !important;
        max-width: none !important;
        margin: 20px auto;
        max-height: 90vh;
    }
    
    /* Swipeable charts */
    .chart-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x mandatory;
    }
    
    .chart-item {
        scroll-snap-align: center;
        min-width: 100%;
    }
    
    /* Mobile tables */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    /* Collapsible sections */
    .panel-header {
        cursor: pointer;
        padding: 20px;
        position: relative;
    }
    
    .panel-header::after {
        content: '▼';
        position: absolute;
        right: 20px;
        top: 50%;
        transform: translateY(-50%);
        transition: transform 0.3s;
    }
    
    .panel.collapsed .panel-header::after {
        transform: translateY(-50%) rotate(-90deg);
    }
    
    .panel.collapsed .panel-content {
        display: none;
    }
}

/* ==================== SMOOTH NUMBER ANIMATIONS ==================== */
.metric-value {
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.metric-value.updating {
    animation: pulse 0.5s ease-in-out;
    color: var(--primary-green);
}

/* ==================== PROFESSIONAL TOOLTIPS ==================== */
.tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.tooltip.show {
    opacity: 1;
}

.tooltip::before {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 6px solid rgba(0, 0, 0, 0.9);
}

/* ==================== ENHANCED DATA TABLES ==================== */
.data-table {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.data-table th {
    background: rgba(0, 204, 102, 0.1);
    backdrop-filter: blur(10px);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 1px;
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.data-table tr {
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.data-table tr:hover {
    background: rgba(255, 255, 255, 0.05);
    transform: scale(1.01);
}

/* ==================== SMOOTH SCROLLING ==================== */
html {
    scroll-behavior: smooth;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(0, 204, 102, 0.3);
    border-radius: 5px;
    transition: background 0.3s;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 204, 102, 0.5);
}

/* ==================== FOCUS STATES ==================== */
*:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 204, 102, 0.3);
}

*:focus:not(:focus-visible) {
    box-shadow: none;
}

*:focus-visible {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

/* ==================== PERFORMANCE OPTIMIZATIONS ==================== */
.will-animate {
    will-change: transform, opacity;
}

.hardware-accelerated {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

/* ==================== RESPONSIVE IMAGES ==================== */
img {
    max-width: 100%;
    height: auto;
    image-rendering: -webkit-optimize-contrast;
}

/* ==================== PRINT STYLES ==================== */
@media print {
    .header, .language-selector, .no-print {
        display: none !important;
    }
    
    .card, .panel {
        break-inside: avoid;
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
}