/* Trading Dashboard Custom Styles */
/* Fix dark theme text visibility */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #1a1d23;  /* Dark background */
    color: #e9ecef;  /* Light text */
    line-height: 1.6;
}

/* Override Bootstrap default text colors */
.text-muted {
    color: #a6a5a5 !important; /* Bootstrap’s text-dark */
}

/* Card text colors */
.card {
    background-color: #2d3339;
    color: #e9ecef;
    border: 1px solid #495057;
}

.card-body {
    color: #e9ecef;
}

/* Table text colors */
.table {
    color: #e9ecef;
}

.table th {
    color: #e9ecef;
    background-color: #495057;
}

/* Form controls */
.form-control {
    background-color: #495057;
    border-color: #6c757d;
    color: #e9ecef;
}

.form-control:focus {
    background-color: #495057;
    border-color: var(--primary-color);
    color: #e9ecef;
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-select {
    background-color: #495057;
    border-color: #6c757d;
    color: #e9ecef;
}

/* Navigation text */
.navbar-dark .navbar-nav .nav-link {
    color: rgba(255, 255, 255, 0.85);
}

/* System info text */
.list-unstyled li {
    color: #e9ecef;
}

/* Ensure all text is visible */
h1, h2, h3, h4, h5, h6, p, span, div, small {
    color: inherit;
}

/* Modal text */
.modal-content {
    background-color: #2d3339;
    color: #e9ecef;
}

.modal-header,
.modal-footer {
    background-color: #495057;
    color: #e9ecef;
    border-color: #6c757d;
}

/* Root Variables */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
    --border-radius: 0.375rem;
    --box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --box-shadow-lg: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition: all 0.15s ease-in-out;
}

/* Global Styles */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f6fa;
    line-height: 1.6;
}

/* Custom Card Styles */
.card {
    border: none;
    box-shadow: var(--box-shadow);
    border-radius: var(--border-radius);
    transition: var(--transition);
    margin-bottom: 1.5rem;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
}

.card.shadow {
    box-shadow: var(--box-shadow-lg) !important;
}

.card-header {
    background-color: var(--light-color);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

.card-header.bg-primary {
    background-color: var(--primary-color) !important;
    border-bottom: none;
}

/* Navigation Enhancements */
.navbar-brand {
    font-weight: 700;
    font-size: 1.25rem;
}

.nav-link {
    font-weight: 500;
    transition: var(--transition);
}

.nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
}

.nav-link.active {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: var(--border-radius);
}

/* Status Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.5rem;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 500;
}

.status-online {
    background-color: rgba(25, 135, 84, 0.1);
    color: var(--success-color);
}

.status-offline {
    background-color: rgba(220, 53, 69, 0.1);
    color: var(--danger-color);
}

.status-warning {
    background-color: rgba(255, 193, 7, 0.1);
    color: #856404;
}

/* Button Enhancements */
.btn {
    font-weight: 500;
    border-radius: var(--border-radius);
    transition: var(--transition);
    border: 1px solid transparent;
}

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

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

.btn-group .btn:hover {
    transform: none;
}

/* Loading States */
.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.8;
}

.btn-loading .btn-text {
    opacity: 0.6;
}

.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Form Enhancements */
.form-control {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: var(--transition);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.form-control.form-control-lg {
    padding: 0.75rem 1rem;
    font-size: 1.125rem;
}

.form-select {
    border-radius: var(--border-radius);
    transition: var(--transition);
}

.form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

/* Input Group Enhancements */
.input-group .form-control:focus {
    z-index: 3;
}

.input-group-text {
    background-color: var(--light-color);
    border-color: #ced4da;
}

/* Form Validation States */
.form-control.is-valid {
    border-color: var(--success-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='m2.3 6.73.94-.94 1.46 1.46-2.4 2.4-1.46-1.46z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

.form-control.is-invalid {
    border-color: var(--danger-color);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12' width='12' height='12' fill='none' stroke='%23dc3545'%3e%3ccircle cx='6' cy='6' r='4.5'/%3e%3cpath d='m5.5 5.5 5 5'/%3e%3cpath d='m5.5 10.5 5-5'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Table Enhancements */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
}

.table th {
    font-weight: 600;
    border-bottom: 2px solid #dee2e6;
    background-color: var(--light-color);
}

.table-hover tbody tr:hover {
    background-color: rgba(13, 110, 253, 0.05);
}

.table-responsive {
    border-radius: var(--border-radius);
}

/* Badge Enhancements */
.badge {
    font-weight: 500;
    border-radius: 50px;
    padding: 0.5em 0.75em;
}

.badge i {
    margin-right: 0.25rem;
}

/* Alert Enhancements */
.alert {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
}

.alert-info {
    background-color: #e7f3ff;
    color: #055160;
    border-left: 4px solid var(--info-color);
}

.alert-success {
    background-color: #d1e7dd;
    color: #0a3622;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    background-color: #f8d7da;
    color: #58151c;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border-left: 4px solid var(--warning-color);
}

/* Progress Bar Enhancements */
.progress {
    height: 0.5rem;
    border-radius: 50px;
    background-color: #e9ecef;
    overflow: hidden;
}

.progress-bar {
    border-radius: 50px;
    transition: width 0.6s ease;
}

.progress-bar-striped {
    background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.15) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.15) 50%, rgba(255, 255, 255, 0.15) 75%, transparent 75%, transparent);
    background-size: 1rem 1rem;
}

.progress-bar-animated {
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% { background-position-x: 1rem; }
}

/* Modal Enhancements */
.modal-content {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow-lg);
}

.modal-header {
    border-bottom: 1px solid #dee2e6;
    background-color: var(--light-color);
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    background-color: var(--light-color);
}

/* Quick Actions Grid */
.quick-actions .btn {
    height: 100%;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 1rem;
}

.quick-actions .btn div {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.quick-actions .btn small {
    font-size: 0.75rem;
    opacity: 0.8;
}

/* Dashboard Statistics Cards */
.stat-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0056b3 100%);
    color: white;
    border-radius: var(--border-radius);
    padding: 1.5rem;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.stat-card .stat-icon {
    font-size: 2rem;
    opacity: 0.3;
    position: absolute;
    right: 1rem;
    top: 1rem;
}

/* System Status */
.system-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background-color: var(--success-color);
    animation: pulse 2s infinite;
}

.status-dot.offline {
    background-color: var(--danger-color);
}

.status-dot.warning {
    background-color: var(--warning-color);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(25, 135, 84, 0); }
    100% { box-shadow: 0 0 0 0 rgba(25, 135, 84, 0); }
}

/* Footer Enhancements */
footer {
    background: linear-gradient(135deg, var(--dark-color) 0%, #1a1d23 100%);
    margin-top: 3rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .quick-actions .btn {
        min-height: 60px;
        padding: 0.75rem;
    }
    
    .modal-dialog {
        margin: 1rem;
    }
}

@media (max-width: 576px) {
    .display-6 {
        font-size: 1.5rem;
    }
    
    .btn-group .btn {
        padding: 0.375rem 0.5rem;
        font-size: 0.8rem;
    }
    
    .badge {
        font-size: 0.7rem;
    }
    
    .card-header {
        padding: 0.75rem 1rem;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #1a1d23;
        color: #e9ecef;
    }
    
    .card {
        background-color: #2d3339;
        border: 1px solid #495057;
    }
    
    .card-header {
        background-color: #495057;
        border-bottom-color: #6c757d;
    }
    
    .table {
        color: #e9ecef;
    }
    
    .table th {
        background-color: #495057;
        border-bottom-color: #6c757d;
    }
    
    .form-control {
        background-color: #495057;
        border-color: #6c757d;
        color: #e9ecef;
    }
    
    .form-control:focus {
        background-color: #495057;
        border-color: var(--primary-color);
        color: #e9ecef;
    }
}

/* Print Styles */
@media print {
    .navbar,
    .btn,
    .modal,
    footer {
        display: none !important;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
    
    .container {
        max-width: none;
        width: 100%;
    }
}

/* Accessibility Enhancements */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .card {
        border: 2px solid #000;
    }
    
    .btn {
        border-width: 2px;
    }
    
    .form-control {
        border-width: 2px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}