/* Custom CSS for Trading Platform */

:root {
    --primary-color: #007bff;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #343a40;
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    --gradient-danger: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Global Styles */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f5f7fa;
    line-height: 1.6;
}

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

.navbar-nav .nav-link {
    font-weight: 500;
    transition: all 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #fff !important;
    transform: translateY(-1px);
}

/* Cards */
.card {
    border: none;
    border-radius: 15px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.card-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid #dee2e6;
    font-weight: 600;
}

/* Buttons */
.btn {
    border-radius: 10px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: none;
    padding: 0.75rem 1.5rem;
}

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

.btn-primary {
    background: var(--gradient-primary);
}

.btn-success {
    background: var(--gradient-success);
}

.btn-danger {
    background: var(--gradient-danger);
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
}

/* Forms */
.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.input-group-text {
    background-color: #f8f9fa;
    border: 2px solid #e9ecef;
    border-right: none;
    border-radius: 10px 0 0 10px;
}

.input-group .form-control {
    border-left: none;
    border-radius: 0 10px 10px 0;
}

/* ===== UNIFIED NOTIFICATION SYSTEM ===== */

/* Notification Container */
.notification-container {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10000;
    max-width: 350px;
    pointer-events: none;
}

/* Individual Notification */
.notification {
    position: relative;
    margin-bottom: 8px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    overflow: hidden;
    pointer-events: auto;
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    max-height: 80px;
}

.notification-show {
    transform: translateX(0);
    opacity: 1;
}

.notification-hide {
    transform: translateX(100%);
    opacity: 0;
    max-height: 0;
    margin-bottom: 0;
}

/* Notification Content */
.notification-content {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    position: relative;
    z-index: 2;
}

.notification-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    border-radius: 50%;
    font-size: 14px;
}

.notification-message {
    flex: 1;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.4;
    word-wrap: break-word;
}

.notification-close {
    flex-shrink: 0;
    background: none;
    border: none;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 8px;
    font-size: 12px;
}

.notification-close:hover {
    background-color: rgba(0, 0, 0, 0.1);
    transform: scale(1.1);
}

/* Progress Bar */
.notification-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 12px 12px;
    animation: progressBar 3s linear forwards;
}

@keyframes progressBar {
    from { width: 100%; }
    to { width: 0%; }
}

/* Notification Types */
.notification-success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
}

.notification-success .notification-icon {
    background: rgba(255, 255, 255, 0.2);
}

.notification-success .notification-progress {
    background: rgba(255, 255, 255, 0.4);
}

.notification-error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
}

.notification-error .notification-icon {
    background: rgba(255, 255, 255, 0.2);
}

.notification-error .notification-progress {
    background: rgba(255, 255, 255, 0.4);
}

.notification-warning {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
}

.notification-warning .notification-icon {
    background: rgba(255, 255, 255, 0.2);
}

.notification-warning .notification-progress {
    background: rgba(255, 255, 255, 0.4);
}

.notification-info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
}

.notification-info .notification-icon {
    background: rgba(255, 255, 255, 0.2);
}

.notification-info .notification-progress {
    background: rgba(255, 255, 255, 0.4);
}

.notification-loading {
    background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
    color: white;
}

.notification-loading .notification-icon {
    background: rgba(255, 255, 255, 0.2);
}

.notification-loading .notification-progress {
    background: rgba(255, 255, 255, 0.4);
    animation: progressBar 10s linear forwards;
}

/* Responsive Design */
@media (max-width: 768px) {
    .notification-container {
        top: 5px;
        right: 5px;
        left: 5px;
        max-width: none;
    }
    
    .notification {
        margin-bottom: 6px;
    }
    
    .notification-content {
        padding: 10px 12px;
    }
    
    .notification-message {
        font-size: 0.8rem;
    }
}

/* Legacy Alert Support (for backward compatibility) */
.alert {
    border: none;
    border-radius: 8px;
    font-weight: 500;
    z-index: 9999;
    position: fixed;
    top: 10px;
    right: 10px;
    min-width: 250px;
    max-width: 300px;
    font-size: 0.875rem;
    padding: 0.75rem 1rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    pointer-events: auto;
    display: block;
    margin-bottom: 5px;
    opacity: 0.95;
    backdrop-filter: blur(10px);
}

.alert-success {
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
    color: #155724;
}

.alert-danger {
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
    color: #721c24;
}

.alert-warning {
    background: linear-gradient(135deg, #fff3cd 0%, #ffeaa7 100%);
    color: #856404;
}

.alert-info {
    background: linear-gradient(135deg, #d1ecf1 0%, #bee5eb 100%);
    color: #0c5460;
}

/* Tables */
.table {
    border-radius: 10px;
    overflow: hidden;
}

.table thead th {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border: none;
    font-weight: 600;
    color: var(--dark-color);
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
    transform: scale(1.01);
}

/* Badges */
.badge {
    font-size: 0.8rem;
    padding: 0.5rem 0.75rem;
    border-radius: 20px;
    font-weight: 500;
}

/* Console Output */
.console-output {
    background: linear-gradient(135deg, #1e1e1e 0%, #2d2d2d 100%);
    color: #ffffff;
    padding: 20px;
    border-radius: 10px;
    height: 300px;
    overflow-y: auto;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.5;
    border: 1px solid #444;
}

.console-message {
    margin-bottom: 8px;
    padding: 2px 0;
}

.console-timestamp {
    color: #888;
    margin-right: 12px;
    font-weight: 500;
}

.console-level {
    margin-right: 12px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 11px;
}

.console-info .console-level {
    background-color: #4CAF50;
    color: white;
}

.console-success .console-level {
    background-color: #8BC34A;
    color: white;
}

.console-warning .console-level {
    background-color: #FF9800;
    color: white;
}

.console-error .console-level {
    background-color: #F44336;
    color: white;
}

.console-text {
    color: #ffffff;
}

/* Dashboard Stats Cards */
.card.bg-primary {
    background: var(--gradient-primary) !important;
}

.card.bg-success {
    background: var(--gradient-success) !important;
}

.card.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
}

.card.bg-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%) !important;
}

/* Dropdown */
.dropdown-menu {
    border: none;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    min-width: 200px;
}

.dropdown-menu-end {
    right: 0;
    left: auto;
}

.dropdown-item {
    padding: 0.75rem 1.5rem;
    transition: all 0.3s ease;
    border-radius: 0;
}

.dropdown-item:hover {
    background-color: rgba(0, 123, 255, 0.1);
    color: var(--primary-color);
}

.dropdown-item:first-child {
    border-radius: 10px 10px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 10px 10px;
}

.dropdown-divider {
    margin: 0.5rem 0;
    border-color: #e9ecef;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
    .card {
        margin-bottom: 1rem;
    }
    
    .btn-lg {
        padding: 0.75rem 1.5rem;
        font-size: 1rem;
    }
    
    .console-output {
        height: 250px;
        font-size: 12px;
    }
}

/* Custom Scrollbar */
.console-output::-webkit-scrollbar {
    width: 8px;
}

.console-output::-webkit-scrollbar-track {
    background: #2d2d2d;
    border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.console-output::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-online {
    background-color: var(--success-color);
    box-shadow: 0 0 10px rgba(40, 167, 69, 0.5);
}

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

.status-error {
    background-color: var(--danger-color);
    box-shadow: 0 0 10px rgba(220, 53, 69, 0.5);
}

/* Progress Bars */
.progress {
    height: 8px;
    border-radius: 10px;
    background-color: #e9ecef;
}

.progress-bar {
    border-radius: 10px;
    background: var(--gradient-primary);
}

/* Tooltips */
.tooltip {
    font-size: 0.875rem;
}

.tooltip-inner {
    background-color: var(--dark-color);
    border-radius: 6px;
    padding: 8px 12px;
}

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

.modal-header {
    border-bottom: 1px solid #e9ecef;
    border-radius: 15px 15px 0 0;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 15px 15px;
}

/* Footer */
footer {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%) !important;
    border-top: 1px solid #495057;
    margin-top: auto;
}

footer p {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

/* Flexbox Layout */
.min-vh-100 {
    min-height: 100vh;
}

.flex-grow-1 {
    flex-grow: 1;
}

/* Trading Platform Symbol Selector */
.symbol-autocomplete {
    position: relative;
}

.symbol-input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    background: white;
    transition: all 0.3s ease;
    color: var(--dark-color);
}

.symbol-input:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: translateY(-1px);
}

.symbol-input::placeholder {
    color: var(--secondary-color);
    font-weight: 400;
}

.symbol-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 12px;
    max-height: 320px;
    overflow: hidden;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    border: 2px solid rgba(102, 126, 234, 0.1);
}

.symbol-dropdown::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid white;
    z-index: 1001;
}

.symbol-dropdown-content {
    max-height: 320px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary-color) transparent;
}

.symbol-dropdown-content::-webkit-scrollbar {
    width: 6px;
}

.symbol-dropdown-content::-webkit-scrollbar-track {
    background: transparent;
}

.symbol-dropdown-content::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.symbol-item {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid #f1f3f4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s ease;
    position: relative;
}

.symbol-item:last-child {
    border-bottom: none;
}

.symbol-item:hover,
.symbol-item.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(3px);
}

.symbol-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--gradient-primary);
}

.symbol-left {
    display: flex;
    align-items: center;
    flex: 1;
}

.symbol-badge {
    width: 36px;
    height: 36px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    margin-right: 12px;
    text-transform: uppercase;
    box-shadow: var(--shadow);
}

.symbol-item:hover .symbol-badge,
.symbol-item.active .symbol-badge {
    background: white;
    color: var(--primary-color);
    transform: scale(1.05);
}

.symbol-info {
    flex: 1;
}

.symbol-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--dark-color);
    margin-bottom: 2px;
}

.symbol-item:hover .symbol-text,
.symbol-item.active .symbol-text {
    color: white;
}

.symbol-subtitle {
    font-size: 12px;
    color: var(--secondary-color);
    font-weight: 400;
}

.symbol-item:hover .symbol-subtitle,
.symbol-item.active .symbol-subtitle {
    color: rgba(255, 255, 255, 0.8);
}

.symbol-source {
    font-size: 10px;
    color: var(--info-color);
    background: rgba(23, 162, 184, 0.1);
    padding: 4px 8px;
    border-radius: 8px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.symbol-item:hover .symbol-source,
.symbol-item.active .symbol-source {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.symbol-loading,
.symbol-empty {
    padding: 20px;
    text-align: center;
    color: var(--secondary-color);
    font-size: 14px;
}

.symbol-loading {
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    background-size: 400% 400%;
    animation: shimmer 1.5s ease-in-out infinite;
}

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

.recent-chips {
    margin-top: 12px;
}

.recent-chips .label {
    font-size: 12px;
    color: var(--secondary-color);
    margin-bottom: 8px;
    display: block;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.recent-chip {
    display: inline-block;
    padding: 6px 12px;
    margin: 3px 6px 3px 0;
    background: var(--light-color);
    border: 2px solid #e9ecef;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--dark-color);
}

.recent-chip:hover {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.recent-chip:active {
    transform: translateY(0);
}

/* Enhanced UX Animations */
.symbol-dropdown {
    animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.symbol-item {
    animation: fadeIn 0.1s ease-out forwards;
    opacity: 0;
}

.symbol-item:nth-child(1) { animation-delay: 0.05s; }
.symbol-item:nth-child(2) { animation-delay: 0.1s; }
.symbol-item:nth-child(3) { animation-delay: 0.15s; }
.symbol-item:nth-child(4) { animation-delay: 0.2s; }
.symbol-item:nth-child(5) { animation-delay: 0.25s; }

@keyframes fadeIn {
    to {
        opacity: 1;
    }
}

/* Focus states for accessibility */
.symbol-input:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

.symbol-item:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

.recent-chip:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Loading state improvements */
.symbol-loading i {
    color: var(--primary-color);
}

.symbol-empty {
    color: var(--secondary-color);
    font-style: italic;
}

.symbol-empty i {
    color: var(--info-color);
}

.autocomplete-loading {
    padding: 12px;
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
}

.autocomplete-empty {
    padding: 12px;
    text-align: center;
    color: #6c757d;
    font-size: 0.85rem;
}

.recent-symbols {
    margin-top: 6px;
}

.recent-symbols small {
    font-size: 0.75rem;
    color: #6c757d;
    display: block;
    margin-bottom: 4px;
}

.recent-symbol-chip {
    display: inline-block;
    padding: 3px 8px;
    margin: 1px 2px 1px 0;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    font-size: 0.7rem;
    cursor: pointer;
    transition: all 0.15s ease;
    color: #495057;
}

.recent-symbol-chip:hover {
    background: #007bff;
    border-color: #007bff;
    color: white;
    transform: translateY(-1px);
}

#symbolSuggestions, #chartSymbolSuggestions {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#symbolSuggestions .suggestions-container, 
#chartSymbolSuggestions .suggestions-container {
    max-height: 280px;
    overflow-y: auto;
}

.suggestions-container .suggestion-item {
    padding: 8px 12px;
    font-size: 0.9rem;
}

.suggestions-container .suggestion-item strong {
    color: #495057;
}

.suggestions-container .suggestion-item small {
    color: #6c757d;
}

/* Recent Symbols Styles */
#recentSymbols .recent-symbol {
    display: inline-block;
    margin: 2px;
    padding: 4px 8px;
    background-color: #e9ecef;
    border: 1px solid #ced4da;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

#recentSymbols .recent-symbol:hover {
    background-color: #007bff;
    color: white;
    transform: translateY(-1px);
}

/* Responsive Footer */
@media (max-width: 768px) {
    footer {
        padding: 1rem 0 !important;
    }
    
    footer p {
        font-size: 0.8rem;
    }
    
    /* Mobile suggestions */
    #symbolSuggestions, #chartSymbolSuggestions {
        font-size: 0.85rem;
    }
    
    .suggestions-container .suggestion-item {
        padding: 10px 12px;
    }
}
