/* CSS Variables for consistent theming */
:root {
    /* Primary Colors */
    --primary-color: #667eea;
    --primary-dark: #5a6fd8;
    --primary-light: #8b9cf0;
    
    /* Background Colors */
    --bg-color: #f8f9fa;
    --card-bg: #ffffff;
    --header-bg: #f8f9fa;
    --hover-bg: #e9ecef;
    
    /* Text Colors */
    --text-color: #333333;
    --text-muted: #6c757d;
    --text-light: #ffffff;
    
    /* Border Colors */
    --border-color: #dee2e6;
    --border-light: #e9ecef;
    
    /* Status Colors */
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    
    /* Shadow */
    --shadow-light: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 8px rgba(0,0,0,0.15);
    --shadow-heavy: 0 8px 16px rgba(0,0,0,0.2);
    
    /* Border Radius */
    --border-radius: 8px;
    --border-radius-sm: 4px;
    --border-radius-lg: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-color);
    background-image: 
        radial-gradient(circle at 25% 25%, rgba(102, 126, 234, 0.03) 0%, transparent 50%),
        radial-gradient(circle at 75% 75%, rgba(118, 75, 162, 0.03) 0%, transparent 50%);
    min-height: 100vh;
    color: var(--text-color);
    line-height: 1.6;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-color);
    min-height: 100vh;
}

/* Authentication Styles */
.auth-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

.auth-card {
    background: white;
    padding: 40px;
    border-radius: 15px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.auth-card h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Base Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    line-height: 1.4;
    min-height: 44px;
    position: relative;
    overflow: hidden;
}

.btn:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn:hover:before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn:active {
    transform: translateY(0);
}

.btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Button Variants - Apply base styles to all variants */
.btn-primary,
.btn-secondary,
.btn-success,
.btn-danger,
.btn-warning,
.btn-info {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s ease;
    line-height: 1.4;
    min-height: 44px;
    position: relative;
    overflow: hidden;
}

.btn-primary:before,
.btn-secondary:before,
.btn-success:before,
.btn-danger:before,
.btn-warning:before,
.btn-info:before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.btn-primary:hover:before,
.btn-secondary:hover:before,
.btn-success:hover:before,
.btn-danger:hover:before,
.btn-warning:hover:before,
.btn-info:hover:before {
    left: 100%;
}

.btn-primary:hover,
.btn-secondary:hover,
.btn-success:hover,
.btn-danger:hover,
.btn-warning:hover,
.btn-info:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

.btn-primary:active,
.btn-secondary:active,
.btn-success:active,
.btn-danger:active,
.btn-warning:active,
.btn-info:active {
    transform: translateY(0);
}

.btn-primary:focus,
.btn-secondary:focus,
.btn-success:focus,
.btn-danger:focus,
.btn-warning:focus,
.btn-info:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

/* Individual variant styles */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    border: 1px solid var(--primary-color);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    border-color: var(--primary-dark);
}

.btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    background: var(--hover-bg);
    border-color: var(--primary-light);
    color: var(--primary-color);
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
    color: var(--text-light);
    border: 1px solid var(--success-color);
}

.btn-success:hover {
    background: linear-gradient(135deg, #20c997 0%, var(--success-color) 100%);
    border-color: #20c997;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #e83e8c 100%);
    color: var(--text-light);
    border: 1px solid var(--danger-color);
}

.btn-danger:hover {
    background: linear-gradient(135deg, #e83e8c 0%, var(--danger-color) 100%);
    border-color: #e83e8c;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #fd7e14 100%);
    color: #000;
    border: 1px solid var(--warning-color);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #fd7e14 0%, var(--warning-color) 100%);
    border-color: #fd7e14;
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #6f42c1 100%);
    color: var(--text-light);
    border: 1px solid var(--info-color);
}

.btn-info:hover {
    background: linear-gradient(135deg, #6f42c1 0%, var(--info-color) 100%);
    border-color: #6f42c1;
}

/* Button Sizes */
.btn-sm,
.btn-primary.btn-sm,
.btn-secondary.btn-sm,
.btn-success.btn-sm,
.btn-danger.btn-sm,
.btn-warning.btn-sm,
.btn-info.btn-sm {
    padding: 8px 16px;
    font-size: 12px;
    min-height: 36px;
}

.btn-lg,
.btn-primary.btn-lg,
.btn-secondary.btn-lg,
.btn-success.btn-lg,
.btn-danger.btn-lg,
.btn-warning.btn-lg,
.btn-info.btn-lg {
    padding: 16px 32px;
    font-size: 16px;
    min-height: 52px;
}

/* Full Width Button */
.btn-block,
.btn-primary.btn-block,
.btn-secondary.btn-block,
.btn-success.btn-block,
.btn-danger.btn-block,
.btn-warning.btn-block,
.btn-info.btn-block {
    width: 100%;
}

/* Disabled State */
.btn:disabled,
.btn.disabled,
.btn-primary:disabled,
.btn-secondary:disabled,
.btn-success:disabled,
.btn-danger:disabled,
.btn-warning:disabled,
.btn-info:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.btn:disabled:hover,
.btn.disabled:hover,
.btn-primary:disabled:hover,
.btn-secondary:disabled:hover,
.btn-success:disabled:hover,
.btn-danger:disabled:hover,
.btn-warning:disabled:hover,
.btn-info:disabled:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* Button Groups */
.btn-group {
    display: inline-flex;
    gap: 0;
}

.btn-group .btn,
.btn-group .btn-primary,
.btn-group .btn-secondary,
.btn-group .btn-success,
.btn-group .btn-danger,
.btn-group .btn-warning,
.btn-group .btn-info {
    border-radius: 0;
    margin: 0;
}

.btn-group .btn:first-child,
.btn-group .btn-primary:first-child,
.btn-group .btn-secondary:first-child,
.btn-group .btn-success:first-child,
.btn-group .btn-danger:first-child,
.btn-group .btn-warning:first-child,
.btn-group .btn-info:first-child {
    border-top-left-radius: var(--border-radius);
    border-bottom-left-radius: var(--border-radius);
}

.btn-group .btn:last-child,
.btn-group .btn-primary:last-child,
.btn-group .btn-secondary:last-child,
.btn-group .btn-success:last-child,
.btn-group .btn-danger:last-child,
.btn-group .btn-warning:last-child,
.btn-group .btn-info:last-child {
    border-top-right-radius: var(--border-radius);
    border-bottom-right-radius: var(--border-radius);
}

/* Icon Buttons */
.btn-icon-only {
    width: 44px;
    height: 44px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-icon-only.btn-sm {
    width: 36px;
    height: 36px;
}

.btn-icon-only.btn-lg {
    width: 52px;
    height: 52px;
}

.error {
    color: #dc3545;
    margin-top: 10px;
    text-align: center;
}

.success {
    color: #28a745;
    margin-top: 10px;
    text-align: center;
}

/* Main Application Styles */
.app-header {
    background: white;
    padding: 15px 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.app-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
}

.app-title {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.logout-btn {
    background: linear-gradient(135deg, var(--danger-color) 0%, #e83e8c 100%);
    color: var(--text-light);
    border: 1px solid var(--danger-color);
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: linear-gradient(135deg, #e83e8c 0%, var(--danger-color) 100%);
    border-color: #e83e8c;
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.nav-tabs {
    display: flex;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 30px;
}

.nav-tab {
    flex: 1;
    padding: 15px 20px;
    text-align: center;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
    font-weight: 500;
}

.nav-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.nav-tab:hover:not(.active) {
    background: #e9ecef;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Sub-tabs Styles */
.trading-sub-tabs,
.operations-sub-tabs,
.risk-analytics-sub-tabs,
.master-data-sub-tabs {
    display: flex;
    background: white;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.sub-tab {
    flex: 1;
    padding: 12px 16px;
    text-align: center;
    background: #f8f9fa;
    border: none;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 13px;
    font-weight: 500;
    border-right: 1px solid #e9ecef;
}

.sub-tab:last-child {
    border-right: none;
}

.sub-tab.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.sub-tab:hover:not(.active) {
    background: #e9ecef;
}

.sub-tab-content {
    display: none;
}

.sub-tab-content.active {
    display: block;
}

.card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.card + .card {
    margin-top: 20px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f8f9fa;
}

.card-title {
    font-size: 18px;
    font-weight: bold;
    color: #333;
}



.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
}

.table tr:hover {
    background: #f8f9fa;
}

.status-active {
    color: #28a745;
    font-weight: 600;
}

.status-pending {
    color: #ffc107;
    font-weight: 600;
}

.status-cancelled {
    color: #dc3545;
    font-weight: 600;
}

.status-executed {
    color: #17a2b8;
    font-weight: 600;
}

.status-settled {
    color: #28a745;
    font-weight: 600;
}

.status-draft {
    color: #6c757d;
    font-weight: 600;
}

.status-sent {
    color: #17a2b8;
    font-weight: 600;
}

.status-paid {
    color: #28a745;
    font-weight: 600;
}

.status-overdue {
    color: #dc3545;
    font-weight: 600;
}

.status-planned {
    color: #17a2b8;
    font-weight: 600;
}

.status-in-transit {
    color: #ffc107;
    font-weight: 600;
}

.status-delivered {
    color: #28a745;
    font-weight: 600;
}

.status-delayed {
    color: #dc3545;
    font-weight: 600;
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.metric-card {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    text-align: center;
}

.metric-value {
    font-size: 32px;
    font-weight: bold;
    color: #667eea;
    margin-bottom: 10px;
}

.metric-label {
    color: #666;
    font-size: 14px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.form-row input,
.form-row select {
    padding: 10px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 14px;
}

.form-row input:focus,
.form-row select:focus {
    outline: none;
    border-color: #667eea;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

.close {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
}

.close:hover {
    color: #333;
}

.hidden {
    display: none;
}

.loading {
    text-align: center;
    padding: 20px;
    color: #666;
}

.chart-container {
    height: 400px;
    margin: 20px 0;
    position: relative;
    overflow: hidden;
    width: 100%;
    max-width: 100%;
}

.chart-container canvas {
    max-width: 100%;
    height: auto;
}

.risk-high {
    color: #dc3545;
    font-weight: 600;
}

.risk-medium {
    color: #ffc107;
    font-weight: 600;
}

.risk-low {
    color: #28a745;
    font-weight: 600;
}

.position-long {
    color: #28a745;
    font-weight: 600;
}

.position-short {
    color: #dc3545;
    font-weight: 600;
}

/* Performance Optimizations - Pagination Controls */
.pagination-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.pagination-info {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-buttons .btn {
    width: auto;
    padding: 8px 12px;
    font-size: 14px;
    min-width: 40px;
    min-height: 36px;
}

.pagination-buttons .btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    border: 1px solid var(--primary-color);
}

.pagination-buttons .btn-secondary {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    margin-top: 0;
}

.pagination-buttons .btn-secondary:hover {
    background: var(--hover-bg);
    border-color: var(--primary-light);
    color: var(--primary-color);
}

/* Loading Indicators */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 8px;
    margin: 10px 0;
    gap: 10px;
}

.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-indicator span {
    color: #666;
    font-size: 14px;
}

/* Performance optimizations for large tables */
.table-container {
    overflow-x: auto;
    max-height: 600px;
    overflow-y: auto;
}

.table-container table {
    min-width: 800px;
}

/* Virtual scrolling for very large datasets */
.virtual-scroll-container {
    height: 400px;
    overflow-y: auto;
    position: relative;
}

.virtual-scroll-content {
    position: relative;
}

.virtual-scroll-item {
    position: absolute;
    width: 100%;
    height: 50px; /* Fixed height for each row */
}

/* Debounced search input */
.search-input {
    transition: border-color 0.3s ease;
}

.search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}



/* Smooth transitions for better UX */
.table tr {
    transition: background-color 0.2s ease;
}

.metric-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0,0,0,0.15);
}

/* Responsive design improvements */
@media (max-width: 768px) {
    .nav-tabs {
        flex-direction: column;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .app-header-content {
        flex-direction: column;
        gap: 15px;
    }
    
    .pagination-controls {
        flex-direction: column;
        text-align: center;
    }
    
    .pagination-buttons {
        justify-content: center;
    }
    
    .table-container {
        max-height: 400px;
    }
    
    .metric-card {
        padding: 20px;
    }
    
    .metric-value {
        font-size: 24px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .btn {
        border: 2px solid currentColor;
    }
    
    .table th {
        background: #000;
        color: #fff;
    }
    
    .table tr:hover {
        background: #333;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .spinner {
        animation: none;
    }
    
    .btn,
    .metric-card,
    .table tr {
        transition: none;
    }
    
    .btn:hover,
    .metric-card:hover {
        transform: none;
    }
}

/* Additional status classes for Risk & Analytics */
.status-mitigated {
    background-color: #17a2b8;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-closed {
    background-color: #6c757d;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-final {
    background-color: #28a745;
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.positive {
    color: #28a745;
    font-weight: bold;
}

.negative {
    color: #dc3545;
    font-weight: bold;
}

.status-inactive {
    color: #6c757d;
    font-weight: 600;
}

/* Dashboard Configuration Styles */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
}

.dashboard-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

.auto-refresh-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-color);
}

.auto-refresh-toggle input[type="checkbox"] {
    margin: 0;
}

.dashboard-widgets {
    display: grid;
    gap: 24px;
    margin-bottom: 24px;
}

.dashboard-layout-grid {
    grid-template-columns: repeat(auto-fit, minmax(450px, 1fr));
}

.dashboard-layout-list {
    grid-template-columns: 1fr;
    max-width: 800px;
    margin: 0 auto;
}

.dashboard-widget {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
}

.dashboard-widget:hover {
    box-shadow: var(--shadow-medium);
    transform: translateY(-2px);
    border-color: var(--primary-light);
}

.widget-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--header-bg);
    font-weight: 600;
}

.widget-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
    letter-spacing: -0.5px;
}

.widget-actions {
    display: flex;
    gap: 5px;
}

.btn-icon {
    background: none;
    border: none;
    padding: 8px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-size: 14px;
}

.btn-icon:hover {
    background: var(--hover-bg);
    color: var(--text-color);
    transform: scale(1.1);
}

.widget-content {
    padding: 24px;
    background: var(--card-bg);
}

/* Metrics Widget */
.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.metric-card {
    padding: 24px 20px;
    border-radius: var(--border-radius);
    text-align: center;
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    position: relative;
    overflow: hidden;
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.metric-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-light);
}

.metric-card:hover::before {
    opacity: 1;
}

.metric-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: var(--text-light);
    border-color: var(--primary-color);
}

.metric-primary .metric-value,
.metric-primary .metric-label {
    color: var(--text-light);
}

.metric-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #20c997 100%);
    color: var(--text-light);
    border-color: var(--success-color);
}

.metric-success .metric-value,
.metric-success .metric-label {
    color: var(--text-light);
}

.metric-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #fd7e14 100%);
    color: #000;
    border-color: var(--warning-color);
}

.metric-warning .metric-value,
.metric-warning .metric-label {
    color: #000;
}

.metric-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #e83e8c 100%);
    color: var(--text-light);
    border-color: var(--danger-color);
}

.metric-danger .metric-value,
.metric-danger .metric-label {
    color: var(--text-light);
}

.metric-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #6f42c1 100%);
    color: var(--text-light);
    border-color: var(--info-color);
}

.metric-info .metric-value,
.metric-info .metric-label {
    color: var(--text-light);
}

.metric-value {
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-color);
    line-height: 1.2;
}

.metric-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Chart Widget */
.chart-container {
    position: relative;
    width: 100%;
    background: var(--card-bg);
    border-radius: var(--border-radius-sm);
    padding: 16px;
    border: 1px solid var(--border-color);
}

/* Table Widget */
.table-compact {
    font-size: 14px;
    border-collapse: collapse;
    width: 100%;
}

.table-compact th,
.table-compact td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.table-compact th {
    background: var(--header-bg);
    font-weight: 600;
    color: var(--text-color);
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

.table-compact tr:hover {
    background: var(--hover-bg);
}

.table-compact tr:nth-child(even) {
    background: var(--bg-color);
}

/* Summary Widget */
.summary-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
}

.summary-metric {
    text-align: center;
    padding: 20px 16px;
    border-radius: var(--border-radius);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.summary-metric:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
    border-color: var(--primary-light);
}

.summary-value {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-color);
}

.summary-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Configuration Modal */
.modal-large {
    max-width: 800px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
}

.config-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.config-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.config-tab:hover {
    color: var(--text-color);
}

.config-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.config-content {
    min-height: 300px;
    max-height: 60vh;
    overflow-y: auto;
    margin-bottom: 20px;
}

.config-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Widget Configuration */
.widgets-config h3,
.layout-config h3,
.preferences-config h3 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.widget-config-item {
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 10px;
    overflow: hidden;
}

.widget-config-header {
    padding: 15px;
    background: var(--bg-color);
    border-bottom: 1px solid var(--border-color);
}

.widget-config-header label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
    cursor: pointer;
}

.widget-config-details {
    padding: 15px;
    background: var(--card-bg);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.widget-config-details label {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 14px;
}

.widget-config-details input,
.widget-config-details select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

/* Layout Configuration */
.layout-option {
    margin-bottom: 15px;
}

.layout-option label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.refresh-config {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.refresh-config label {
    display: flex;
    align-items: center;
    gap: 10px;
}

.refresh-config input {
    width: 100px;
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

/* Preferences Configuration */
.preference-item {
    margin-bottom: 15px;
}

.preference-item label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.preference-item select {
    padding: 8px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
    margin-left: 10px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-header {
        flex-direction: column;
        gap: 15px;
        align-items: stretch;
    }
    
    .dashboard-controls {
        justify-content: center;
    }
    
    .dashboard-layout-grid {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .summary-metrics {
        grid-template-columns: 1fr;
    }
    
    .widget-config-details {
        grid-template-columns: 1fr;
    }
    
    .config-tabs {
        flex-direction: column;
    }
    
    .config-tab {
        text-align: left;
        border-bottom: none;
        border-left: 2px solid transparent;
    }
    
    .config-tab.active {
        border-left-color: var(--primary-color);
        border-bottom-color: transparent;
    }
}

/* Loading States */
.loading {
    text-align: center;
    color: var(--text-muted);
    font-style: italic;
}

.error {
    text-align: center;
    color: var(--danger-color);
    font-style: italic;
}

/* Status Indicators */
.status-pending {
    color: var(--warning-color);
    font-weight: 500;
}

.status-confirmed,
.status-executed,
.status-approved {
    color: var(--success-color);
    font-weight: 500;
}

.status-cancelled,
.status-rejected {
    color: var(--danger-color);
    font-weight: 500;
}

.risk-low {
    color: var(--success-color);
    font-weight: 500;
}

.risk-medium {
    color: var(--warning-color);
    font-weight: 500;
}

.risk-high {
    color: var(--danger-color);
    font-weight: 500;
}

/* Animation for widget updates */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-widget {
    animation: fadeIn 0.3s ease-out;
}

/* Compact mode */
.dashboard-compact .dashboard-widget {
    margin-bottom: 10px;
}

.dashboard-compact .widget-content {
    padding: 15px;
}

.dashboard-compact .metric-card {
    padding: 15px;
}

.dashboard-compact .metric-value {
    font-size: 20px;
}

.dashboard-compact .summary-metric {
    padding: 10px;
}

.dashboard-compact .summary-value {
    font-size: 16px;
}

/* Action Buttons - Subtle and Theme-Blending */
.btn-edit,
.btn-edit.btn-sm,
.btn-edit.btn-lg {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-size: 12px;
    padding: 6px 12px;
    min-height: 32px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.btn-edit:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.btn-edit:active {
    transform: translateY(0);
}

.btn-delete,
.btn-delete.btn-sm,
.btn-delete.btn-lg {
    background: var(--bg-color);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    font-size: 12px;
    padding: 6px 12px;
    min-height: 32px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background: #fff5f5;
    border-color: var(--danger-color);
    color: var(--danger-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.btn-delete:active {
    transform: translateY(0);
}

.btn-execute,
.btn-execute.btn-sm,
.btn-execute.btn-lg {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
    font-size: 12px;
    padding: 6px 12px;
    min-height: 32px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.btn-execute:hover {
    background: var(--hover-bg);
    border-color: var(--success-color);
    color: var(--success-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.btn-execute:active {
    transform: translateY(0);
}

.btn-cancel,
.btn-cancel.btn-sm,
.btn-cancel.btn-lg {
    background: var(--bg-color);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    font-size: 12px;
    padding: 6px 12px;
    min-height: 32px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
}

.btn-cancel:hover {
    background: #fff5f5;
    border-color: var(--danger-color);
    color: var(--danger-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.btn-cancel:active {
    transform: translateY(0);
}

/* Action Button Groups */
.action-buttons {
    display: flex;
    gap: 6px;
    align-items: center;
}

.action-buttons .btn-edit,
.action-buttons .btn-delete {
    margin: 0;
}

/* Icon-based action buttons */
.btn-action {
    background: var(--bg-color);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    padding: 6px;
    min-height: 32px;
    min-width: 32px;
    border-radius: var(--border-radius-sm);
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.btn-action:hover {
    background: var(--hover-bg);
    border-color: var(--primary-color);
    color: var(--primary-color);
    transform: translateY(-1px);
    box-shadow: var(--shadow-light);
}

.btn-action.btn-edit:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-action.btn-delete:hover {
    background: #fff5f5;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

/* Compact action buttons for tables */
.table-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}

.table-actions .btn-edit,
.table-actions .btn-delete,
.table-actions .btn-execute,
.table-actions .btn-cancel {
    padding: 4px 8px;
    font-size: 11px;
    min-height: 28px;
}

/* Alternative subtle styling for existing button classes */
.btn-success.btn-subtle {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-success.btn-subtle:hover {
    background: var(--hover-bg);
    border-color: var(--success-color);
    color: var(--success-color);
}

.btn-danger.btn-subtle {
    background: var(--bg-color);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
}

.btn-danger.btn-subtle:hover {
    background: #fff5f5;
    border-color: var(--danger-color);
    color: var(--danger-color);
}

.btn-warning.btn-subtle {
    background: var(--bg-color);
    color: var(--text-color);
    border: 1px solid var(--border-color);
}

.btn-warning.btn-subtle:hover {
    background: var(--hover-bg);
    border-color: var(--warning-color);
    color: var(--warning-color);
}

/* User Management Styles */
.auth-note {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 15px;
    font-style: italic;
}

.profile-content {
    max-height: 70vh;
    overflow-y: auto;
}

.profile-section {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.profile-section:last-child {
    border-bottom: none;
}

.profile-section h3 {
    margin-bottom: 20px;
    color: var(--text-color);
    font-size: 18px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

/* Admin Panel Styles */
.admin-tabs {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.admin-tab {
    background: none;
    border: none;
    padding: 12px 20px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    transition: all 0.2s ease;
}

.admin-tab:hover {
    color: var(--text-color);
}

.admin-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

.admin-content {
    min-height: 400px;
    max-height: 60vh;
    overflow-y: auto;
}

/* User Management Table */
.users-management {
    margin-top: 20px;
}

.table-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.table-controls input,
.table-controls select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

.table-controls input {
    min-width: 200px;
}

/* Role and Status Badges */
.role-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.role-admin {
    background: #dc3545;
    color: white;
}

.role-manager {
    background: #007bff;
    color: white;
}

.role-trader {
    background: #28a745;
    color: white;
}

.role-analyst {
    background: #ffc107;
    color: #212529;
}

.role-viewer {
    background: #6c757d;
    color: white;
}

.status-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.status-active {
    background: #28a745;
    color: white;
}

.status-inactive {
    background: #6c757d;
    color: white;
}

.status-suspended {
    background: #dc3545;
    color: white;
}

/* Create User Form */
.create-user-form {
    max-width: 600px;
}

.create-user-form h3 {
    margin-bottom: 20px;
    color: var(--text-color);
}

.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.permissions-grid label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}

.permissions-grid input[type="checkbox"] {
    margin: 0;
}

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Activity Logs */
.activity-logs {
    margin-top: 20px;
}

.logs-controls {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    align-items: center;
}

.logs-controls input,
.logs-controls select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: var(--bg-color);
    color: var(--text-color);
}

.logs-container {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
}

/* Responsive Design for User Management */
@media (max-width: 768px) {
    .admin-tabs {
        flex-direction: column;
    }
    
    .admin-tab {
        text-align: left;
        border-bottom: none;
        border-left: 2px solid transparent;
    }
    
    .admin-tab.active {
        border-left-color: var(--primary-color);
        border-bottom-color: transparent;
    }
    
    .table-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .permissions-grid {
        grid-template-columns: 1fr;
    }
    
    .logs-controls {
        flex-direction: column;
        align-items: stretch;
    }
}
