/* Forex Factory Alerts Styles */
.forex-alerts-section {
    background: #2a2e39;
    border-radius: 8px;
    margin: 0;
    overflow: hidden;
    /*max-height: 400px;*/
    height: 93vh;
    overflow-y: auto;
    position: absolute;
    top: 8vh;
    left: 0;
    right: 0;
    z-index: 50;
}

.forex-alerts-header {
    padding: 12px 15px;
    cursor: pointer;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #3a3f4b;
    padding: 5px 5px;
    cursor: pointer;
    justify-content: space-between;
    user-select: none;
    transition: background-color 0.3s ease;
    position: relative;
}

.forex-alerts-header:hover {
    background: #4a4f5b;
}

.forex-alerts-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #e0e0e0;
}

.forex-alerts-toggle {
    color: #8a8f9d;
    font-size: 12px;
    transition: transform 0.3s ease;
}

.forex-alerts-badge {
    background: #f6465d;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
}

.forex-alerts-container {
    border-top: 1px solid #3a3f4b;
    /*max-height: 400px;*/
    overflow-y: auto;
}

.forex-alerts-loading,
.forex-alerts-error,
.forex-alert-empty {
    padding: 20px;
    text-align: center;
    color: #8a8f9d;
    font-size: 14px;
}

.forex-alerts-error {
    color: #f6465d;
    background: rgba(246, 70, 93, 0.1);
}

.forex-alert-item {
    padding: 15px;
    border-bottom: 1px solid #3a3f4b;
    transition: background-color 0.3s ease;
}

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

.forex-alert-item:hover {
    background: #323641;
}

.forex-alert-item.unread {
    background: rgba(30, 144, 255, 0.05);
    border-left: 3px solid #1e90ff;
}

.forex-alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.forex-alert-time {
    font-size: 11px;
    color: #8a8f9d;
    font-weight: 500;
}

.forex-alert-unread-badge {
    background: #1e90ff;
    color: white;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 9px;
    font-weight: bold;
}

.forex-alert-title {
    font-size: 14px;
    font-weight: 600;
    color: #ffffff;
    margin-bottom: 6px;
    line-height: 1.4;
}

.forex-alert-body {
    font-size: 12px;
    color: #b0b0b0;
    line-height: 1.5;
    margin-bottom: 10px;
}

.forex-alert-actions {
    text-align: right;
}

.forex-alert-link {
    color: #1e90ff;
    text-decoration: none;
    font-size: 11px;
    font-weight: 600;
    transition: color 0.3s ease;
}

.forex-alert-link:hover {
    color: #64b5f6;
    text-decoration: underline;
}

/* Scrollbar styling for alerts container */
.forex-alerts-container::-webkit-scrollbar {
    width: 6px;
}

.forex-alerts-container::-webkit-scrollbar-track {
    background: #2a2e39;
}

.forex-alerts-container::-webkit-scrollbar-thumb {
    background: #4a4f5b;
    border-radius: 3px;
}

.forex-alerts-container::-webkit-scrollbar-thumb:hover {
    background: #5a5f6b;
}

/* Integration with existing activeAlarmsList */
.alarm-item.forex-alarm {
    background: rgba(30, 144, 255, 0.1);
    border-left: 3px solid #1e90ff;
}

.alarm-item.forex-alarm .alarm-icon {
    color: #1e90ff;
}

/* Ensure alerts are visible */
.forex-alerts-container[style*="display: block"] {
    display: block !important;
}

.forex-alerts-list[style*="display: block"] {
    display: block !important;
}

.has-new-alerts {
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.forex-ask-ai-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    padding: 4px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    margin-left: 8px;
    transition: all 0.2s ease;
}

.forex-ask-ai-btn:hover {
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4190 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.forex-ask-ai-btn:active {
    transform: translateY(0);
}

.forex-ai-loading {
    font-size: 12px;
    color: #666;
    font-style: italic;
}

.forex-ai-result {
    margin-top: 10px;
    padding: 10px;
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
    border-radius: 4px;
    font-size: 13px;
    line-height: 1.4;
}

.forex-ai-close-btn {
    background: none;
    border: 1px solid #ccc;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 11px;
    margin-top: 8px;
}

.forex-ai-close-btn:hover {
    background: #f5f5f5;
}

/* Whale Tracker Styles */
.whale-tracker-btn {
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4a7f 100%);
    border: 1px solid #3a6ea5;
    color: #e2e8f0;
    padding: 8px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.whale-tracker-btn:hover {
    background: linear-gradient(135deg, #2a4a7f 0%, #3a6ea5 100%);
    border-color: #4a8fd5;
}

.whale-tracker-btn.active {
    background: linear-gradient(135deg, #f6465d 0%, #ff7a45 100%);
    border-color: #ff7a45;
    color: #fff;
}

.whale-badge {
    background: #f6465d;
    color: white;
    border-radius: 10px;
    padding: 2px 7px;
    font-size: 10px;
    font-weight: bold;
    margin-left: 4px;
}

.whale-alerts-container {
    position: fixed;
    top: 10vh;
    right: 42%;
    width: 400px;
    max-width: calc(100vw - 32px);
    max-height: 70vh;
    background: rgba(20, 24, 33, 0.97);
    border: 1px solid #2a4a7f;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    z-index: 5000;
    display: none;
    overflow: hidden;
    flex-direction: column;
    backdrop-filter: blur(6px);
}

.whale-alerts-container[style*="display: block"] {
    display: flex !important;
}

.whale-alerts-header {
    padding: 11px 15px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid #2a4a7f;
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4a7f 100%);
    color: #e2e8f0;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.whale-alerts-clear {
    background: transparent;
    border: 1px solid #4a8fd5;
    color: #4a8fd5;
    border-radius: 4px;
    padding: 3px 10px;
    cursor: pointer;
    font-size: 11px;
}

.whale-alerts-clear:hover {
    background: #4a8fd5;
    color: #fff;
}

.whale-alerts-list {
    padding: 0;
    max-height: calc(70vh - 48px);
    overflow-y: auto;
}

.whale-alerts-list::-webkit-scrollbar {
    width: 6px;
}

.whale-alerts-list::-webkit-scrollbar-track {
    background: #1a1d26;
}

.whale-alerts-list::-webkit-scrollbar-thumb {
    background: #4a4f5b;
    border-radius: 3px;
}

.whale-alerts-list::-webkit-scrollbar-thumb:hover {
    background: #5a5f6b;
}

.whale-alert-empty {
    padding: 25px;
    text-align: center;
    color: #8a8f9d;
    font-size: 13px;
}

.whale-alert-item {
    padding: 12px 15px;
    border-bottom: 1px solid #2a2f3b;
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: background-color 0.3s ease;
}

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

.whale-alert-item:hover {
    background: #232833;
}

.whale-alert-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.whale-alert-direction {
    font-weight: 700;
    font-size: 13px;
}

.whale-alert-direction.buy {
    color: #0ecb81;
}

.whale-alert-direction.sell {
    color: #f6465d;
}

.whale-alert-amount {
    font-size: 15px;
    font-weight: 700;
    color: #e2e8f0;
}

.whale-alert-pair {
    font-size: 12px;
    color: #8a8f9d;
}

.whale-alert-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 11px;
    color: #8a8f9d;
    flex-wrap: wrap;
}

.whale-alert-address {
    font-family: monospace;
    background: #2a2f3b;
    padding: 2px 6px;
    border-radius: 4px;
    color: #4a8fd5;
}

.whale-alert-stats {
    display: flex;
    gap: 6px;
    font-size: 11px;
    flex-wrap: wrap;
}

.whale-alert-stat {
    background: #2a2f3b;
    border-radius: 4px;
    padding: 2px 7px;
    color: #b0b8c4;
}

.whale-alert-stat.winner {
    background: rgba(14, 203, 129, 0.15);
    color: #0ecb81;
    font-weight: 600;
}

.whale-alert-stat.size {
    background: rgba(74, 143, 213, 0.15);
    color: #4a8fd5;
    font-weight: 600;
}

.whale-alert-stat.pnl.pos {
    background: rgba(14, 203, 129, 0.15);
    color: #0ecb81;
    font-weight: 600;
}

.whale-alert-stat.pnl.neg {
    background: rgba(246, 70, 93, 0.15);
    color: #f6465d;
    font-weight: 600;
}

.whale-alert-links {
    display: flex;
    gap: 10px;
    margin-top: 7px;
    font-size: 11px;
}

.whale-alert-link {
    color: #4a8fd5;
    text-decoration: none;
    font-weight: 600;
}

.whale-alert-link:hover {
    text-decoration: underline;
    color: #6aa9e0;
}

/* Whale toast notification */
.whale-toast {
    position: fixed;
    bottom: 80px;
    right: 20px;
    left: 20px;
    max-width: 240px;
    margin: 0 auto; /* centers it when width < max-width */
    background: linear-gradient(135deg, #1e3a5f 0%, #2a4a7f 100%);
    border: 1px solid #ff7a45;
    border-radius: 10px;
    padding: 14px 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    color: #e2e8f0;
    cursor: pointer;
    animation: whale-toast-in 0.35s ease;
}

@media (max-width: 480px) {
    .whale-toast {
        left: 12px;
        right: 12px;
        max-width: none; /* let it fill the width minus margins */
    }
}

@keyframes whale-toast-in {
    from { transform: translateX(120%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.whale-toast-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 6px;
    color: #ff7a45;
}

.whale-toast-body {
    font-size: 12px;
    line-height: 1.5;
}

.whale-toast-body .whale-toast-amount {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
}

.whale-toast-body .whale-toast-pair {
    color: #8a8f9d;
}

/* Account tab - Whale Tracker settings */
.whale-settings-group {
    background: #2a2e39;
    border-radius: 8px;
    padding: 18px 20px;
    margin: 16px 0;
}

.whale-settings-group h3 {
    margin: 0 0 6px 0;
    font-size: 16px;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.whale-settings-group .setting-desc {
    font-size: 12px;
    color: #8a8f9d;
    margin: 0 0 14px 0;
}

.whale-setting-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 16px;
}

.whale-setting-row label {
    font-size: 13px;
    color: #c0c8d4;
    font-weight: 600;
}

.whale-setting-row .row-desc {
    font-size: 11px;
    color: #8a8f9d;
    margin-top: -4px;
}

.whale-threshold-select {
    background: #1a1d26;
    border: 1px solid #3a3f4b;
    color: #e2e8f0;
    border-radius: 6px;
    padding: 8px 10px;
    font-size: 13px;
    max-width: 280px;
}

.whale-toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.whale-toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.whale-toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.whale-toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #3a3f4b;
    transition: 0.3s;
    border-radius: 24px;
}

.whale-toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background: #e2e8f0;
    transition: 0.3s;
    border-radius: 50%;
}

.whale-toggle-switch input:checked + .whale-toggle-slider {
    background: #f6465d;
}

.whale-toggle-switch input:checked + .whale-toggle-slider:before {
    transform: translateX(20px);
}

.whale-settings-status {
    font-size: 12px;
    margin-top: 8px;
}

.whale-settings-status.success {
    color: #0ecb81;
}

.whale-settings-status.error {
    color: #f6465d;
}

/* Mobile: center the whale tracker panel and toast on screen */
@media (max-width: 768px) {
    .forex-alerts-section {
        top: 15vh;
    }

    .whale-alerts-container {
        top: 16vh;
        right: auto;
        left: 50%;
        transform: translateX(-50%);
        width: calc(100vw - 24px);
        max-width: calc(100vw - 24px);
        max-height: 75vh;
    }

    .whale-toast {
        bottom: 80px;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        max-width: 320px;
        width: 90vw;
    }

    @keyframes whale-toast-in {
        from { opacity: 0; transform: translateX(-50%) translateY(20px); }
        to { opacity: 1; transform: translateX(-50%) translateY(0); }
    }
}