/* 
 * Alert System Styles
 * TradePro Portfolio Manager - Real-time Notifications
 */

/* Alert Notifications Container */
.alert-notifications-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    max-width: 400px;
    pointer-events: none;
}

/* Individual Alert Notification */
.alert-notification {
    background: var(--surface-color);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 12px;
    padding: 1rem;
    border-left: 4px solid var(--primary-color);
    animation: slideInAlert 0.3s ease-out;
    pointer-events: all;
    max-width: 100%;
    word-wrap: break-word;
    backdrop-filter: blur(10px);
}

/* Priority Colors */
.alert-notification.priority-low {
    border-left-color: var(--success-color);
    background: rgba(52, 168, 83, 0.05);
}

.alert-notification.priority-medium {
    border-left-color: var(--warning-color);
    background: rgba(251, 188, 4, 0.05);
}

.alert-notification.priority-high {
    border-left-color: var(--error-color);
    background: rgba(234, 67, 53, 0.05);
    animation: slideInAlert 0.3s ease-out, pulse 2s infinite;
}

/* Alert Header */
.alert-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.alert-title {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
    line-height: 1.2;
}

.alert-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 0;
    margin-left: 0.5rem;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

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

/* Alert Message */
.alert-message {
    color: var(--text-primary);
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

/* Alert Time */
.alert-time {
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-style: italic;
}

/* Animations */
@keyframes slideInAlert {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes pulse {
    0%, 100% { 
        box-shadow: var(--shadow-lg); 
    }
    50% { 
        box-shadow: var(--shadow-lg), 0 0 20px rgba(234, 67, 53, 0.3); 
    }
}

/* Alert Dashboard Modal */
.alert-dashboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.alert-dashboard-modal.show {
    display: flex;
}

.alert-dashboard-content {
    background: var(--surface-color);
    border-radius: 12px;
    max-width: 900px;
    max-height: 80vh;
    width: 90%;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    position: relative;
}

.alert-dashboard-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.alert-dashboard-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.alert-dashboard-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.alert-dashboard-close:hover {
    background: var(--error-background);
    color: var(--error-color);
}

.alert-dashboard-body {
    padding: 2rem;
}

/* Alert Management Section */
.alert-management-section {
    margin-bottom: 2rem;
}

.alert-section-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Alert Statistics */
.alert-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.alert-stat-card {
    background: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid var(--primary-color);
    text-align: center;
}

.alert-stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--primary-color);
    display: block;
}

.alert-stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

/* Alert List */
.alert-list {
    background: var(--background-color);
    border-radius: 8px;
    overflow: hidden;
}

.alert-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

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

.alert-item:hover {
    background: rgba(var(--primary-color-rgb), 0.05);
}

.alert-item.triggered {
    background: rgba(52, 168, 83, 0.1);
    border-left: 4px solid var(--success-color);
}

.alert-item.disabled {
    opacity: 0.6;
    background: rgba(0, 0, 0, 0.05);
}

.alert-info {
    flex: 1;
}

.alert-symbol {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 1rem;
}

.alert-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.alert-meta {
    color: var(--text-secondary);
    font-size: 0.8rem;
    margin-top: 0.5rem;
}

.alert-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.alert-toggle {
    width: 40px;
    height: 20px;
    background: var(--border-color);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

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

.alert-toggle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.3s ease;
}

.alert-toggle.enabled::before {
    transform: translateX(20px);
}

.alert-delete {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 4px;
    transition: all 0.2s ease;
}

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

/* Create Alert Form */
.create-alert-form {
    background: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: end;
}

.form-group {
    flex: 1;
}

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.form-input, .form-select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--surface-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.2s ease;
}

.form-input:focus, .form-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

.create-alert-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s ease;
    white-space: nowrap;
}

.create-alert-btn:hover {
    background: rgba(var(--primary-color-rgb), 0.9);
}

/* Alert System Settings */
.alert-settings {
    background: var(--background-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

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

.setting-label {
    font-weight: 500;
    color: var(--text-primary);
}

.setting-description {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-top: 0.25rem;
}

/* Alert Type Badges */
.alert-type-badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.alert-type-badge.price {
    background: rgba(26, 115, 232, 0.15);
    color: var(--primary-color);
}

.alert-type-badge.institutional {
    background: rgba(52, 168, 83, 0.15);
    color: var(--success-color);
}

.alert-type-badge.breakout {
    background: rgba(251, 188, 4, 0.15);
    color: var(--warning-color);
}

.alert-type-badge.risk {
    background: rgba(234, 67, 53, 0.15);
    color: var(--error-color);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .alert-notifications-container {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
    
    .alert-notification {
        margin-bottom: 8px;
    }
    
    .alert-dashboard-content {
        width: 95%;
        max-height: 90vh;
    }
    
    .alert-dashboard-header {
        padding: 1rem;
    }
    
    .alert-dashboard-body {
        padding: 1rem;
    }
    
    .alert-stats {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-row {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .alert-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .alert-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Dark Theme Adjustments */
[data-theme="dark"] .alert-notification {
    background: rgba(30, 30, 30, 0.95);
    border-color: var(--border-color);
}

[data-theme="dark"] .alert-notification.priority-low {
    background: rgba(52, 168, 83, 0.15);
}

[data-theme="dark"] .alert-notification.priority-medium {
    background: rgba(251, 188, 4, 0.15);
}

[data-theme="dark"] .alert-notification.priority-high {
    background: rgba(234, 67, 53, 0.15);
}

/* Alert Header Button */
.header-alerts-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 8px;
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
}

.header-alerts-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.header-alerts-btn .alert-count {
    background: var(--error-color);
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    position: absolute;
    top: -8px;
    right: -8px;
}

.header-alerts-btn .icon {
    font-size: 1.1rem;
}

.header-alerts-btn .text {
    font-size: 0.9rem;
}

@media (max-width: 768px) {
    .header-alerts-btn .text {
        display: none;
    }
    
    .header-alerts-btn {
        padding: 0.75rem;
        min-width: 48px;
        justify-content: center;
    }
}