* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #2c9caf 0%, #4bb5c7 100%);
    min-height: 100vh;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.header {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.header h1 {
    color: #2c3e50;
    font-size: 2.5em;
    margin-bottom: 10px;
}

.header p {
    color: #7f8c8d;
    font-size: 1.1em;
}

.connection-status {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 15px;
    flex-wrap: wrap;
}

.status-badge {
    padding: 8px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.9em;
}

.status-connected {
    background: #27ae60;
    color: white;
}

.status-disconnected {
    background: #e74c3c;
    color: white;
}

.tabs {
    display: flex;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 15px;
    padding: 10px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.tab {
    flex: 1;
    padding: 15px 30px;
    text-align: center;
    background: none;
    border: none;
    border-radius: 10px;
    font-size: 1.1em;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.3s ease;
}

.tab.active {
    background: linear-gradient(135deg, #2c9caf 0%, #4bb5c7 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(44, 156, 175, 0.4);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-card.success { border-left: 5px solid #27ae60; }
.stat-card.pending { border-left: 5px solid #f39c12; }
.stat-card.failed { border-left: 5px solid #e74c3c; }
.stat-card.total { border-left: 5px solid #2c9caf; }
.stat-card.incomplete { border-left: 5px solid #9b59b6; }

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    margin: 10px 0;
}

.stat-success { color: #27ae60; }
.stat-pending { color: #f39c12; }
.stat-failed { color: #e74c3c; }
.stat-total { color: #2c9caf; }
.stat-incomplete { color: #9b59b6; }

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 30px;
    margin-bottom: 30px;
}

.chart-container {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.chart-title {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 20px;
    color: #2c3e50;
    text-align: center;
}

.filters {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.filter-group {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group label {
    font-weight: 600;
    color: #2c3e50;
}

.filter-group select, .filter-group input {
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: white;
}

.filter-btn {
    background: linear-gradient(135deg, #2c9caf 0%, #4bb5c7 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: 600;
}

.merchant-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.merchant-card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.merchant-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #ecf0f1;
}

.merchant-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #2c3e50;
}

.merchant-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat-item {
    text-align: center;
    padding: 10px;
}

.stat-value {
    font-size: 1.5em;
    font-weight: bold;
    color: #2c9caf;
}

.stat-label {
    font-size: 0.9em;
    color: #7f8c8d;
}

.recent-transactions {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.table-container {
    overflow-x: auto;
    border-radius: 10px;
    max-height: 400px;
    overflow-y: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ecf0f1;
}

th {
    background: #f8f9fa;
    font-weight: 600;
    color: #2c3e50;
    position: sticky;
    top: 0;
}

tr:hover {
    background: #f8f9fa;
}

.status-success { color: #27ae60; font-weight: 600; }
.status-pending { color: #f39c12; font-weight: 600; }
.status-failed { color: #e74c3c; font-weight: 600; }
.status-in { color: #3498db; font-weight: 600; }
.status-out { color: #27ae60; font-weight: 600; }

.metadata-popup {
    background: #f8f9fa;
    padding: 10px;
    border-radius: 5px;
    font-family: monospace;
    font-size: 0.9em;
    max-width: 400px;
    word-break: break-all;
}

.loading {
    text-align: center;
    padding: 50px;
    color: #7f8c8d;
}

.refresh-btn {
    background: linear-gradient(135deg, #2c9caf 0%, #4bb5c7 100%);
    color: white;
    border: none;
    padding: 12px 25px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: all 0.3s ease;
    margin-bottom: 20px;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(44, 156, 175, 0.4);
}

.tab-timer {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 10px 20px;
    margin-left: auto;
    font-size: 0.9em;
    color: #2c9caf;
    font-weight: 600;
}

.server-info {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
    text-align: center;
}

.server-info .connected {
    color: #27ae60;
    font-weight: bold;
}

.server-info .disconnected {
    color: #e74c3c;
    font-weight: bold;
}

@media (max-width: 768px) {
    .charts-grid, .merchant-grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 10px;
    }
    
    .header h1 {
        font-size: 2em;
    }
    
    .filter-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .tabs {
        flex-direction: column;
    }
}
/* Add to existing CSS */
.tab-timer {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 10px 20px;
    margin-left: auto;
    font-size: 0.9em;
    color: #2c9caf;
    font-weight: 600;
    min-width: 200px;
    text-align: center;
    transition: all 0.3s ease;
}

.tab-timer:hover {
    background: rgba(44, 156, 175, 0.1);
    transform: scale(1.05);
}

.tab {
    position: relative;
    transition: all 0.3s ease;
}

.tab:hover {
    background: rgba(44, 156, 175, 0.1);
    transform: translateY(-2px);
}

/* Manual switch confirmation */
.switch-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #2c9caf;
    color: white;
    padding: 10px 20px;
    border-radius: 5px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1001;
    animation: slideIn 0.5s ease;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
/* Card and Container Text Colors - Improved Contrast */
.stat-card h3 {
    color: #2c3e50 !important;
    font-weight: 700;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.stat-card .stat-number {
    color: #2c3e50 !important;
    font-size: 1.8em;
    font-weight: 800;
    margin: 10px 0;
    line-height: 1.2;
}

.stat-card p {
    color: #5d6d7e !important;
    font-size: 0.9em;
    margin: 0;
    font-weight: 500;
}

.merchant-card {
    background: #ffffff !important;
    border: 1px solid #e0e0e0 !important;
}

.merchant-card .merchant-name {
    color: #2c3e50 !important;
    font-weight: 700;
    font-size: 1.1em;
}

.merchant-card .stat-item .stat-value {
    color: #2c3e50 !important;
    font-weight: 700;
    font-size: 1.3em;
}

.merchant-card .stat-item .stat-label {
    color: #5d6d7e !important;
    font-weight: 500;
    font-size: 0.85em;
}

.chart-title, .section-title {
    color: #2c3e50 !important;
    font-weight: 700;
    margin: 20px 0 15px 0;
    font-size: 1.4em;
    text-shadow: none;
}

/* Fix amount overflow in cards */
.stat-card.amount .stat-number,
.small-amount {
    font-size: 1.4em !important;
    word-break: break-word;
    overflow-wrap: break-word;
}

/* Table text contrast */
.recent-transactions th {
    color: #2c3e50 !important;
    background: #f8f9fa !important;
}

.recent-transactions td {
    color: #34495e !important;
}

/* Filter text contrast */
.filters label {
    color: #2c3e50 !important;
    font-weight: 600;
}

.filter-group select, .filter-group input {
    color: #2c3e50 !important;
    border: 1px solid #bdc3c7 !important;
}

/* Success rate badges text contrast */
.success-rate {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
}

.success-rate.high {
    background: #d4edda !important;
    color: #155724 !important;
}

.success-rate.medium {
    background: #fff3cd !important;
    color: #856404 !important;
}

.success-rate.low {
    background: #f8d7da !important;
    color: #721c24 !important;
}

/* Export buttons text contrast */
.export-btn {
    background: #5a6268 !important;
    color: white !important;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    transition: background 0.3s;
}

.export-btn:hover {
    background: #495057 !important;
}

/* Status colors in tables */
.status-successful { 
    color: #155724 !important; 
    background: #d4edda !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-pending { 
    color: #856404 !important; 
    background: #fff3cd !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-failed { 
    color: #721c24 !important; 
    background: #f8d7da !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-in { 
    color: #004085 !important; 
    background: #cce5ff !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

.status-out { 
    color: #155724 !important; 
    background: #d4edda !important;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
}

/* Responsive text sizes */
@media (max-width: 768px) {
    .stat-card .stat-number {
        font-size: 1.5em !important;
    }
    
    .stat-card.amount .stat-number,
    .small-amount {
        font-size: 1.2em !important;
    }
    
    .merchant-card .stat-item .stat-value {
        font-size: 1.1em !important;
    }
}

@media (max-width: 480px) {
    .stat-card .stat-number {
        font-size: 1.3em !important;
    }
    
    .stat-card.amount .stat-number,
    .small-amount {
        font-size: 1.1em !important;
    }
    
    .merchant-card .stat-item .stat-value {
        font-size: 1em !important;
    }
}
/* Alert Notifications */
.alert-notification {
    margin-bottom: 20px;
    animation: slideDown 0.5s ease;
}

.alert-banner {
    padding: 15px 20px;
    border-radius: 10px;
    margin-bottom: 15px;
    border-left: 5px solid;
    background: #fff;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.alert-banner.warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.alert-banner h3 {
    margin: 0 0 8px 0;
    font-size: 1.2em;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-banner p {
    margin: 5px 0;
    line-height: 1.5;
}

.alert-banner small {
    opacity: 0.8;
    font-size: 0.9em;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Manual Alert Trigger Button */
.manual-alert-btn {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.9em;
    margin-left: 10px;
    transition: background 0.3s;
}

.manual-alert-btn:hover {
    background: #c0392b;
}