/* css/alerts.css - Styles pour les alertes de prix */

/* ═══════════════════════════════════════════════════════════════
   MODAL ALERTES - CONTAINER PRINCIPAL
   Classes uniques pour éviter les conflits CSS
   ═══════════════════════════════════════════════════════════════ */

.alerts-modal-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
}

.alerts-modal-container.active {
    display: block;
}

.alerts-modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.alerts-modal-dialog {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(30, 30, 40, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 16px;
    width: 90%;
    max-width: 700px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
}

.alerts-modal-container.active .alerts-modal-dialog {
    animation: alertModalAppear 0.3s ease-out;
}

@keyframes alertModalAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

.alerts-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    flex-shrink: 0;
}

.alerts-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: white;
}

.alerts-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.alerts-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.alerts-modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

/* ═══════════════════════════════════════════════════════════════
   BOUTON ALERTES HEADER
   ═══════════════════════════════════════════════════════════════ */

.alerts-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #374151;
    border: 2px solid #4b5563;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 9999px;
    transition: all 0.2s ease;
}

.alerts-btn:hover {
    background: #374151;
    border-color: #667eea;
    color: #667eea;
    transform: translateY(-1px);
}

.alerts-btn .icon {
    font-size: 16px;
}

#alertsBadge {
    position: absolute;
    top: 2px;
    right: 2px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: var(--color-danger, #ef4444);
    color: white;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
}

#alertsBadge.visible {
    opacity: 1;
    transform: scale(1);
}

/* ═══════════════════════════════════════════════════════════════
   MODAL ALERTES - CONTENU
   ═══════════════════════════════════════════════════════════════ */

/* Stats */
.alerts-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    padding: 16px;
    background: var(--surface-secondary, rgba(255, 255, 255, 0.05));
    border-radius: 12px;
    margin-bottom: 20px;
}

.alert-stat {
    text-align: center;
}

.alert-stat .stat-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: var(--color-primary, #667eea);
}

.alert-stat .stat-label {
    font-size: 12px;
    color: var(--text-secondary, #888);
    text-transform: uppercase;
}

.alert-stat.clickable {
    cursor: pointer;
    border-radius: 8px;
    transition: background-color 0.2s, transform 0.1s;
}

.alert-stat.clickable:hover {
    background: rgba(102, 126, 234, 0.15);
    transform: scale(1.05);
}

.alert-stat.clickable:active {
    transform: scale(0.98);
}

/* Tabs */
.alerts-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
    padding-bottom: 8px;
}

.alerts-tabs .tab-btn {
    background: transparent;
    border: none;
    padding: 8px 16px;
    color: var(--text-secondary, #888);
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    transition: all 0.2s;
}

.alerts-tabs .tab-btn:hover {
    color: var(--text-primary, #fff);
    background: rgba(255, 255, 255, 0.05);
}

.alerts-tabs .tab-btn.active {
    color: var(--color-primary, #667eea);
    background: rgba(102, 126, 234, 0.1);
}

/* Liste alertes */
.alerts-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.alert-item {
    display: grid;
    grid-template-columns: auto 1fr auto auto auto;
    gap: 16px;
    align-items: center;
    padding: 12px 16px;
    background: var(--surface-secondary, rgba(255, 255, 255, 0.05));
    border-radius: 12px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.alert-item:hover {
    background: var(--surface-tertiary, rgba(255, 255, 255, 0.08));
}

.alert-item.inactive {
    opacity: 0.6;
}

.alert-item.inactive .alert-card-img {
    filter: grayscale(0.5);
}

/* Card info */
.alert-card-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.alert-card-img {
    width: 40px;
    height: 56px;
    object-fit: cover;
    border-radius: 4px;
}

.alert-card-details {
    display: flex;
    flex-direction: column;
}

.alert-card-name {
    font-weight: 600;
    font-size: 14px;
}

.alert-card-set {
    font-size: 12px;
    color: var(--text-secondary, #888);
}

/* Condition */
.alert-condition {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 20px;
}

.alert-type-icon {
    font-size: 16px;
}

.alert-type {
    font-size: 12px;
    color: var(--text-secondary, #888);
}

.alert-target {
    font-weight: 700;
    color: var(--color-primary, #667eea);
}

/* Current price */
.alert-current {
    text-align: right;
}

.current-label {
    font-size: 11px;
    color: var(--text-secondary, #888);
    display: block;
}

.current-price {
    font-weight: 600;
    font-size: 14px;
}

/* Actions */
.alert-actions {
    display: flex;
    gap: 8px;
}

.alert-actions .btn-icon {
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.2s;
}

.alert-actions .btn-icon:hover {
    background: rgba(255, 255, 255, 0.1);
}

.alert-actions .alert-delete:hover {
    background: rgba(239, 68, 68, 0.2);
}

/* ═══════════════════════════════════════════════════════════════
   NOTIFICATIONS
   ═══════════════════════════════════════════════════════════════ */

.notifications-list {
    max-height: 400px;
    overflow-y: auto;
}

.notifications-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    margin-bottom: 12px;
    border-bottom: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
}

.notifications-header .btn-text {
    background: none;
    border: none;
    color: var(--color-primary, #667eea);
    cursor: pointer;
    font-size: 13px;
}

.notifications-header .btn-text:hover {
    text-decoration: underline;
}

.notification-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.2s;
    margin-bottom: 8px;
}

.notification-item:hover {
    background: rgba(255, 255, 255, 0.05);
}

.notification-item.unread {
    background: rgba(102, 126, 234, 0.1);
    border-left: 3px solid var(--color-primary, #667eea);
}

.notif-card-img {
    width: 36px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
}

.notif-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.notif-card-name {
    font-weight: 600;
    font-size: 14px;
}

.notif-message {
    font-size: 13px;
}

.notif-message .change {
    font-weight: 600;
}

.notif-message .change.positive {
    color: var(--color-success, #22c55e);
}

.notif-message .change.negative {
    color: var(--color-danger, #ef4444);
}

.notif-date {
    font-size: 11px;
    color: var(--text-secondary, #888);
}

/* ═══════════════════════════════════════════════════════════════
   MODAL CRÉATION ALERTE
   ═══════════════════════════════════════════════════════════════ */

#createAlertModal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

#createAlertModal.active {
    opacity: 1;
    visibility: visible;
}

.create-alert-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

.create-alert-dialog {
    position: relative;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    width: 90%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.2s ease-out;
}

#createAlertModal.active .create-alert-dialog {
    transform: scale(1) translateY(0);
}

.create-alert-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 16px 16px 0 0;
}

.create-alert-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: white;
}

.create-alert-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.create-alert-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

.create-alert-body {
    padding: 20px;
}

.create-alert-card-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    margin-bottom: 16px;
}

.create-alert-card-info strong {
    font-size: 15px;
    color: #fff;
}

.create-alert-card-info span {
    font-size: 12px;
    color: #888;
}

.create-alert-field {
    margin-bottom: 16px;
}

.create-alert-field label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #aaa;
    margin-bottom: 8px;
}

.create-alert-field select,
.create-alert-field input {
    width: 100%;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.create-alert-field select:focus,
.create-alert-field input:focus {
    outline: none;
    border-color: #667eea;
}

.create-alert-field select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}

.create-alert-input-group {
    display: flex;
    align-items: stretch;
}

.create-alert-input-group input {
    flex: 1;
    border-radius: 8px 0 0 8px;
    border-right: none;
}

.create-alert-input-group span {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: none;
    border-radius: 0 8px 8px 0;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
}

.create-alert-field small {
    display: block;
    margin-top: 8px;
    font-size: 12px;
    color: #888;
}

.create-alert-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.create-alert-btn-cancel,
.create-alert-btn-submit {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.create-alert-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
}

.create-alert-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

.create-alert-btn-submit {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border: none;
    color: white;
}

.create-alert-btn-submit:hover {
    filter: brightness(1.1);
}

.alert-card-preview {
    padding: 12px;
    background: var(--surface-secondary, rgba(255, 255, 255, 0.05));
    border-radius: 8px;
}

.input-with-suffix {
    display: flex;
    align-items: center;
}

.input-with-suffix input {
    flex: 1;
    border-radius: 8px 0 0 8px;
}

.input-suffix {
    padding: 10px 14px;
    background: var(--surface-tertiary, rgba(255, 255, 255, 0.1));
    border-radius: 0 8px 8px 0;
    font-weight: 600;
    min-width: 40px;
    text-align: center;
}

.form-hint {
    font-size: 12px;
    color: var(--text-secondary, #888);
    margin-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════════════════════════ */

.alerts-list .empty-state,
.notifications-list .empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary, #888);
}

.empty-state .empty-icon {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    margin: 4px 0;
}

.empty-state .empty-hint {
    font-size: 13px;
    opacity: 0.7;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .alerts-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .alert-item {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto auto;
        gap: 8px;
    }

    .alert-condition {
        grid-column: 1 / -1;
        justify-self: start;
    }

    .alert-current {
        grid-column: 1;
        text-align: left;
    }

    .alert-actions {
        grid-column: 2;
        justify-self: end;
    }
}

@media (max-width: 480px) {
    .alerts-stats {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    .alert-stat .stat-value {
        font-size: 20px;
    }
}
