:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --dark-color: #212529;
    --light-color: #f8f9fa;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f7fa;
}

/* Navbar Styles */
.navbar-brand {
    font-weight: 600;
    font-size: 1.3rem;
}

.navbar-dark .navbar-brand i {
    color: var(--success-color);
}

/* Navbar Controls - Unified Design */
.navbar-control {
    height: 40px !important;
    min-height: 40px !important;
    max-height: 40px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 1rem !important;
    font-size: 0.875rem !important;
    font-weight: 600 !important;
    line-height: 1.1 !important;
    white-space: nowrap !important;
    vertical-align: middle !important;
    border-radius: 8px !important;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
}

/* Professional Badge Styles */
.badge-professional {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.badge-professional:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#tradingModeBadge.live-mode {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 2px 8px rgba(245, 87, 108, 0.3);
}

#tradingModeBadge.live-mode:hover {
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.badge-status {
}

#botStatusBadge.running {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    box-shadow: 0 2px 8px rgba(56, 239, 125, 0.3);
}

#botStatusBadge.stopped {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    box-shadow: 0 2px 8px rgba(235, 51, 73, 0.3);
}

#botStatusBadge:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Stat Cards */
.stat-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s, box-shadow 0.2s;
    overflow: hidden;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.stat-card .card-header {
    padding: 0.75rem 1rem;
    font-weight: 600;
    border-bottom: none;
}

.stat-card .card-header h6 {
    font-size: 0.875rem;
    font-weight: 600;
    margin: 0;
}

.stat-card .card-header small {
    display: block;
    font-size: 0.7rem;
    font-weight: 400;
    margin-top: 0.25rem;
    opacity: 0.85;
}

.stat-card .card-body {
    padding: 1.5rem 1rem;
}

.stat-card .card-body h3 {
    font-size: 2rem;
    font-weight: 700;
    color: #2c3e50;
    margin: 0;
}

/* Gradient Header Backgrounds */
.bg-gradient-purple {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
}

.bg-gradient-teal {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%) !important;
    border: none !important;
}

.bg-gradient-purple h5,
.bg-gradient-teal h5 {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.bg-gradient-purple small,
.bg-gradient-teal small {
    display: block;
    font-size: 0.75rem;
    font-weight: 400;
    opacity: 0.85;
}

.stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

/* Card Styles */
.card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.card-header {
    background-color: white;
    border-bottom: 1px solid #e9ecef;
    border-radius: 12px 12px 0 0 !important;
    padding: 1rem 1.25rem;
}

.card-header h5 {
    color: var(--dark-color);
    font-weight: 600;
    font-size: 1.1rem;
}

.card-header h5 i {
    margin-right: 0.5rem;
    color: var(--primary-color);
}

/* Table Styles */
.table {
    margin-bottom: 0;
}

.table thead {
    background-color: #f8f9fa;
}

.table thead th {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #dee2e6;
    padding: 0.75rem;
}

.table tbody tr {
    transition: background-color 0.15s;
}

.table tbody tr:hover {
    background-color: #f8f9fa;
}

/* Badge Styles for Trades */
.badge.direction-long {
    background-color: var(--success-color);
}

.badge.direction-short {
    background-color: var(--danger-color);
}

.badge.status-open {
    background-color: var(--info-color);
}

.badge.status-closed {
    background-color: var(--dark-color);
}

/* P&L Styling */
.pnl-positive {
    color: var(--success-color);
    font-weight: 600;
}

.pnl-negative {
    color: var(--danger-color);
    font-weight: 600;
}

/* Close Reason Badge Styles */
.badge.close-reason-tp {
    background-color: #198754;
    color: #fff;
}

.badge.close-reason-sl {
    background-color: #dc3545;
    color: #fff;
}

.badge.close-reason-manual {
    background-color: #6f42c1;
    color: #fff;
}

.badge.close-reason-signal {
    background-color: #0d6efd;
    color: #fff;
}

.badge.close-reason-timeout {
    background-color: #fd7e14;
    color: #fff;
}

.badge.close-reason-other {
    background-color: #6c757d;
    color: #fff;
}

/* Professional Button Styles */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.3s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.875rem;
}

/* Bot Control Buttons */
.bot-controls {
    box-shadow: none;
    border-radius: 0;
    overflow: visible;
    height: 40px;
    gap: 0.5rem;
}

.bot-controls .btn-professional {
    border: none;
    gap: 0.5rem;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.btn-professional i {
    font-size: 1.1rem;
    line-height: 1;
}

.btn-professional .btn-text {
    line-height: 1;
}

.btn-professional::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;
}

.btn-professional:hover::before {
    width: 300px;
    height: 300px;
}

.btn-start {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    color: white;
}

.btn-start:hover {
    background: linear-gradient(135deg, #0d7a6f 0%, #2dd062 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(56, 239, 125, 0.4);
}

.btn-start:disabled {
    background: linear-gradient(135deg, #6c757d 0%, #939aa1 100%);
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-stop {
    background: linear-gradient(135deg, #eb3349 0%, #f45c43 100%);
    color: white;
}

.btn-stop:hover {
    background: linear-gradient(135deg, #c92a3a 0%, #d64a37 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(235, 51, 73, 0.4);
}

.btn-stop:disabled {
    background: linear-gradient(135deg, #6c757d 0%, #939aa1 100%);
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Form Styles */
.form-label {
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 0.5rem;
}

.form-control, .form-select {
    border-radius: 8px;
    border: 1px solid #dee2e6;
    padding: 0.625rem 0.875rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}

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

.selected-pairs-preview {
    min-height: 28px;
}

.pair-pill {
    background: linear-gradient(135deg, #0d6efd 0%, #0dcaf0 100%);
    color: #fff;
    border-radius: 999px;
    padding: 0.4rem 0.7rem;
    margin: 0.1rem 0.2rem 0.1rem 0;
    font-size: 0.75rem;
    font-weight: 600;
}

.pair-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pair-option:hover {
    border-color: #0d6efd;
    box-shadow: 0 4px 12px rgba(13, 110, 253, 0.12);
    transform: translateY(-1px);
}

.pair-option input[type="checkbox"] {
    cursor: pointer;
}

/* Pagination */
.pagination {
    margin-top: 1.5rem;
}

.pagination .page-link {
    border-radius: 8px;
    margin: 0 0.25rem;
    color: var(--primary-color);
    border: 1px solid #dee2e6;
}

.pagination .page-item.active .page-link {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

/* Loading Spinner */
.spinner-border-sm {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 0.1rem;
}

/* Charts */
canvas {
    max-height: 300px;
}

/* Responsive */
@media (max-width: 768px) {
    .stat-card {
        margin-bottom: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
    }
    
    .table {
        font-size: 0.875rem;
    }
    
    canvas {
        max-height: 200px;
    }
    
    /* Mobile button adjustments */
    .btn-professional .btn-text {
        display: none;
    }
    
    .btn-professional {
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 0.8rem !important;
    }
    
    .btn-professional i {
        margin: 0;
    }
    
    .badge-professional,
    .badge-status {
        height: 40px !important;
        min-height: 40px !important;
        max-height: 40px !important;
        padding: 0 0.8rem !important;
    }
    
    .badge-professional,
    .badge-status {
        font-size: 0.65rem;
        padding: 0.6rem 0.7rem;
        height: 38px;
    }
    
    .navbar-brand {
        font-size: 1rem;
    }
}

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

.page-content {
    animation: fadeIn 0.3s ease-in-out;
}

/* Success/Error Messages */
.alert {
    border-radius: 8px;
    border: none;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
}

.alert-danger {
    background-color: #f8d7da;
    color: #842029;
}

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

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}
