/* Alert System Styles - Comprehensive styling for Phase 4 Alert System */

/* Alert Tab Content Styles */
.alerts-container {
    padding: 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.alerts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color);
}

.alerts-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.alerts-count {
    background: var(--accent-color);
    color: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    min-width: 16px;
    text-align: center;
}

.alerts-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alerts-header-controls select {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
}

.alerts-header-controls button {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.alerts-header-controls button:hover {
    background: var(--bg-tertiary);
}

.clear-all-btn {
    background: var(--error-color) !important;
    color: white !important;
    border-color: var(--error-color) !important;
}

.clear-all-btn:hover {
    background: #d63384 !important;
}

/* Alerts List Container */
.alerts-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

/* No Alerts Message */
.no-alerts {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    text-align: center;
    color: var(--text-secondary);
}

.no-alerts-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-alerts-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.no-alerts-message {
    margin-bottom: 20px;
    line-height: 1.4;
    max-width: 300px;
}

.create-alert-btn {
    background: var(--accent-color);
    color: var(--bg-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
}

.create-alert-btn:hover {
    background: #d9a70a;
}

/* Symbol Group Styles (Grouped Mode) */
.symbol-group {
    margin-bottom: 16px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    overflow: hidden;
}

.symbol-header {
    background: var(--bg-secondary);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.symbol-name {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 14px;
}

.symbol-count {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 3px;
}

/* Alert Item Styles */
.grouped-alert-item,
.flat-alert-item {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.grouped-alert-item:last-child,
.flat-alert-item:last-child {
    border-bottom: none;
}

.grouped-alert-item:hover,
.flat-alert-item:hover {
    background: rgba(240, 185, 11, 0.05);
}

.flat-alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 8px;
}

.flat-alert-symbol {
    font-weight: 600;
    color: var(--accent-color);
    min-width: 60px;
    font-size: 13px;
}

.flat-alert-details {
    flex: 1;
}

.flat-alert-type-price {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 2px;
}

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

.alert-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.alert-type {
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
}

.alert-type-above {
    background: rgba(14, 203, 129, 0.2);
    color: #0ecb81;
    border: 1px solid rgba(14, 203, 129, 0.3);
}

.alert-type-below {
    background: rgba(246, 70, 93, 0.2);
    color: #f6465d;
    border: 1px solid rgba(246, 70, 93, 0.3);
}

.alert-price {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 13px;
}

.alert-current-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
}

.current-price {
    color: var(--text-secondary);
    font-size: 11px;
}

.flat-alert-distance {
    text-align: center;
    min-width: 80px;
}

.distance-percent {
    font-weight: 600;
    font-size: 12px;
}

.distance-percent.close {
    color: var(--error-color);
}

.distance-percent.medium {
    color: #ffc107;
}

.distance-percent.far {
    color: var(--success-color);
}

.distance-text {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.percent-diff {
    font-weight: 600;
    font-size: 11px;
}

.percent-diff.close {
    color: var(--error-color);
}

.percent-diff.medium {
    color: #ffc107;
}

.percent-diff.far {
    color: var(--success-color);
}

/* Alert Actions */
.alert-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.grouped-alert-item:hover .alert-actions,
.flat-alert-item:hover .alert-actions {
    opacity: 1;
}

.chart-btn-alert,
.edit-alert-btn,
.remove-alert-btn {
    background: none;
    border: none;
    padding: 4px 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    color: var(--text-secondary);
}

.chart-btn-alert:hover {
    background: rgba(14, 203, 129, 0.2);
    color: var(--success-color);
}

.edit-alert-btn:hover {
    background: rgba(240, 185, 11, 0.2);
    color: var(--accent-color);
}

.remove-alert-btn:hover {
    background: rgba(246, 70, 93, 0.2);
    color: var(--error-color);
}

/* Alert Note */
.alert-note {
    margin-top: 8px;
    padding: 6px 8px;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 11px;
    color: var(--text-secondary);
    line-height: 1.3;
}

/* Alert States */
.grouped-alert-item.triggered,
.flat-alert-item.triggered {
    background: rgba(246, 70, 93, 0.1);
    border-color: rgba(246, 70, 93, 0.3);
}

.alert-triggered-flash {
    animation: alertTriggerFlash 2s ease-out;
}

@keyframes alertTriggerFlash {
    0%, 50% {
        background-color: rgba(240, 185, 11, 0.3);
        transform: scale(1.02);
    }
    100% {
        background-color: transparent;
        transform: scale(1);
    }
}

/* Tab Badge */
.tab-alert-count {
    background: var(--error-color);
    color: white;
    font-size: 10px;
    padding: 2px 5px;
    border-radius: 8px;
    margin-left: 4px;
    font-weight: 600;
    min-width: 14px;
    text-align: center;
    display: inline-block;
}

/* Chart Alert Button */
.chart-btn.alert-btn {
    background: rgba(240, 185, 11, 0.1);
    color: var(--accent-color);
    border: 1px solid rgba(240, 185, 11, 0.3);
}

.chart-btn.alert-btn:hover {
    background: rgba(240, 185, 11, 0.2);
}

/* Connection Status Indicator */
.connection-status {
    font-size: 10px;
    margin-left: 8px;
}

.connection-status.connected {
    color: var(--success-color);
}

.connection-status.disconnected {
    color: var(--error-color);
}

.connection-status.error {
    color: #ffc107;
}

/* Responsive Design */
@media (max-width: 768px) {
    .alerts-header {
        flex-direction: column;
        gap: 12px;
        align-items: stretch;
    }
    
    .alerts-header-controls {
        justify-content: space-between;
    }
    
    .flat-alert-item {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .flat-alert-distance {
        text-align: left;
        min-width: auto;
    }
    
    .alert-main {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .alert-current-info {
        justify-content: space-between;
    }
    
    .alert-actions {
        opacity: 1;
        justify-content: flex-end;
    }
}

/* Animations */
@keyframes alertFadeIn {
    0% { 
        opacity: 0; 
        transform: translateY(-10px) scale(0.95); 
    }
    100% { 
        opacity: 1; 
        transform: translateY(0) scale(1); 
    }
}

/* Alert Notification Styles */
.alert-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 16px;
    border-radius: 6px;
    color: white;
    font-weight: 600;
    font-size: 12px;
    z-index: 10000;
    animation: alertFadeIn 0.3s ease-out;
    max-width: 300px;
    word-wrap: break-word;
}

.alert-notification-success {
    background-color: var(--success-color);
}

.alert-notification-error {
    background-color: var(--error-color);
}

.alert-notification-info {
    background-color: var(--accent-color);
    color: var(--bg-primary);
}

/* Loading States */
.alerts-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100px;
    color: var(--text-secondary);
}

.alerts-loading::after {
    content: "Loading alerts...";
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .alert-type-above {
        background: #0ecb81;
        color: var(--bg-primary);
    }
    
    .alert-type-below {
        background: var(--error-color);
        color: white;
    }
    
    .distance-percent.close,
    .percent-diff.close {
        color: var(--error-color);
        font-weight: 700;
    }
    
    .distance-percent.far,
    .percent-diff.far {
        color: var(--success-color);
        font-weight: 700;
    }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    .alert-triggered-flash,
    .alert-notification {
        animation: none;
    }
    
    .grouped-alert-item,
    .flat-alert-item,
    .alert-actions {
        transition: none;
    }
}

/* Dark Mode Adjustments */
@media (prefers-color-scheme: dark) {
    .no-alerts-icon {
        opacity: 0.3;
    }
    
    .symbol-header {
        background: rgba(255, 255, 255, 0.03);
    }
    
    .alert-note {
        background: rgba(255, 255, 255, 0.05);
    }
}

/* Print Styles */
@media print {
    .alert-actions,
    .alerts-header-controls,
    .chart-btn.alert-btn {
        display: none !important;
    }
    
    .alerts-container {
        background: white !important;
        color: black !important;
    }
    
    .flat-alert-item,
    .grouped-alert-item {
        border: 1px solid #ccc !important;
        background: white !important;
    }
}


/* Diagonal Line Alert Styles */
.diagonal-line-alert {
    border-left: 3px solid #2962FF;
}

.diagonal-line-alert .alert-type {
    background: #2962FF;
    color: white;
}

.alert-type-diagonal_line_crossing {
    background: linear-gradient(135deg, #2962FF 0%, #1E53E5 100%);
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

/* Diagonal line specific icons */
.alert-type .line-icon {
    display: inline-block;
    margin-right: 4px;
}

/* Alert condition badges */
.alert-condition {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 4px;
}

.alert-condition.cross-above {
    background: #0ecb81;
    color: white;
}

.alert-condition.cross-below {
    background: #f6465d;
    color: white;
}

.alert-condition.cross-any {
    background: #f0b90b;
    color: #0b0e11;
}

/* Line info in alert display */
.line-info {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.line-strength {
    font-weight: 600;
    color: #2962FF;
}

/* Diagonal alert in grouped view */
.grouped-alert-item.diagonal-line-alert {
    background: linear-gradient(to right, rgba(41, 98, 255, 0.1), transparent);
}

/* Diagonal alert in flat view */
.flat-alert-item.diagonal-line-alert {
    border-left-color: #2962FF;
}

.flat-alert-item.diagonal-line-alert:hover {
    background: rgba(41, 98, 255, 0.05);
}

/* Diagonal line alert modal styles (already added in diagonal-line-alert-integration.js) */
.diagonal-line-alert-modal .alert-modal-header h3 {
    color: #2962FF;
}

/* Line preview in alert list */
.line-preview {
    display: inline-block;
    width: 30px;
    height: 12px;
    margin-left: 8px;
    position: relative;
    overflow: hidden;
}

.line-preview::after {
    content: '';
    position: absolute;
    left: -5px;
    top: 50%;
    width: 40px;
    height: 1px;
    background: #2962FF;
    transform: rotate(-15deg);
    transform-origin: center;
}

.line-preview.support::after {
    background: #0ecb81;
}

.line-preview.resistance::after {
    background: #f6465d;
}
