/* =============================================
   ALERTS PAGE — Clean Minimalist White Design
   ============================================= */

/* Override content-area when alerts are active */
.content-area:has(.alerts-page-container) {
    padding: 0 !important;
    max-width: 100% !important;
    align-items: stretch !important;
}

/* Override chat-container max-width when alerts are active */
.chat-container:has(.alerts-page-container) {
    max-width: 100% !important;
    padding: 0 !important;
    gap: 0 !important;
}

/* Full-screen alerts container */
.alerts-page-container {
    width: 100%;
    height: calc(100vh - 130px);
    display: flex;
    background: #ffffff;
    overflow: hidden;
    animation: alertsPageFadeIn 0.3s ease;
}

@keyframes alertsPageFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* ===================== SIDEBAR ===================== */
.alerts-sidebar {
    width: 340px;
    min-width: 340px;
    display: flex;
    flex-direction: column;
    background: #fafbfc;
    border-right: 1px solid #e8ecf1;
    flex-shrink: 0;
    overflow: hidden;
}

.alerts-sidebar-header {
    padding: 1.25rem 1.25rem 0.75rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.alerts-sidebar-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.alerts-sidebar-icon {
    width: 36px;
    height: 36px;
    background: #f1f5f9;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    color: #64748b;
}

.alerts-sidebar-title {
    font-weight: 700;
    font-size: 1.05rem;
    color: #0f172a;
    letter-spacing: -0.01em;
}

.alerts-sidebar-subtitle {
    font-size: 0.78rem;
    color: #94a3b8;
    margin-top: 1px;
}

.alerts-count-badge {
    background: #f1f5f9;
    color: #64748b;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 20px;
}

/* Search bar in sidebar */
.alerts-search-bar {
    padding: 0 1.25rem;
    margin-bottom: 0.5rem;
    position: relative;
}

.alerts-search-input {
    width: 100%;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 9px 12px 9px 36px;
    color: #0f172a;
    font-size: 0.88rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: all 0.2s;
}

.alerts-search-input::placeholder {
    color: #94a3b8;
}

.alerts-search-input:focus {
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
}

.alerts-search-icon {
    position: absolute;
    left: calc(1.25rem + 11px);
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.8rem;
    pointer-events: none;
}

/* Alerts list */
.alerts-list-container {
    flex: 1;
    overflow-y: auto;
    padding: 4px 10px 10px;
}

.alerts-list-container::-webkit-scrollbar {
    width: 3px;
}

.alerts-list-container::-webkit-scrollbar-track {
    background: transparent;
}

.alerts-list-container::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.08);
    border-radius: 2px;
}

/* Individual alert item */
.alert-item {
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 2px;
    border: 1px solid transparent;
    background: transparent;
}

.alert-item:hover {
    background: #ffffff;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.alert-item.active {
    background: #ffffff;
    border-color: #e2e8f0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.alert-item-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.alert-item-prompt {
    font-size: 0.92rem;
    font-weight: 600;
    color: #1e293b;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    margin-bottom: 5px;
}

.alert-item-time {
    font-size: 0.73rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Delete button on item */
.delete-alert-small {
    background: transparent;
    border: none;
    color: #94a3b8;
    opacity: 0;
    cursor: pointer;
    padding: 5px;
    border-radius: 6px;
    transition: all 0.15s;
    font-size: 0.78rem;
    flex-shrink: 0;
}

.alert-item:hover .delete-alert-small {
    opacity: 0.6;
}

.delete-alert-small:hover {
    color: #ef4444 !important;
    background: #fef2f2;
    opacity: 1 !important;
}

.mobile-sticky-header {
    display: none;
}

.mobile-back-btn {
    display: none;
}

/* ===================== DETAIL VIEW ===================== */
.alert-detail-view {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background: #ffffff;
}

/* Empty state */
.alert-detail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #94a3b8;
    text-align: center;
    padding: 2rem;
}

.alert-detail-empty-icon {
    width: 72px;
    height: 72px;
    background: #f8fafc;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    color: #cbd5e1;
    margin-bottom: 1.2rem;
}

.alert-detail-empty h3 {
    font-weight: 600;
    font-size: 1.05rem;
    color: #475569;
    margin-bottom: 0.4rem;
}

.alert-detail-empty p {
    font-size: 0.9rem;
    color: #94a3b8;
}

/* Detail content area */
.alert-detail-content-wrapper {
    padding: 2rem 2.5rem;
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    animation: alertDetailSlideIn 0.25s ease;
}

@keyframes alertDetailSlideIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Detail header */
.alert-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #f1f5f9;
}

.alert-detail-header-info {
    flex: 1;
    padding-right: 20px;
}

.alert-detail-title-wrapper {
    display: flex;
    align-items: center;
    position: relative;
    width: 100%;
}

.alert-detail-title-input {
    font-size: 1.5rem;
    font-weight: 700;
    color: #0f172a;
    line-height: 1.3;
    letter-spacing: -0.01em;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    outline: none;
    padding: 6px 40px 6px 12px;
    border-radius: 6px;
    flex: 1;
    width: 100%;
    transition: all 0.2s ease;
    font-family: inherit;
}

.alert-detail-title-input.editing {
    background: #ffffff;
    border-color: #cbd5e1;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.edit-prompt-btn {
    position: absolute;
    right: 6px;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.edit-prompt-btn:hover {
    color: #3b82f6;
    background: #eff6ff;
}

.alert-detail-meta {
    display: flex;
    align-items: center;
    gap: 18px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.alert-detail-meta-item {
    font-size: 0.85rem;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 5px;
}

.alert-detail-meta-item i {
    font-size: 0.8rem;
}

.rediscovery-input {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 12px 16px;
    color: #0f172a;
    font-size: 0.92rem;
    font-family: 'Outfit', sans-serif;
    outline: none;
    transition: all 0.2s;
    display: block;
    width: 100%;
    box-sizing: border-box;
}

.rediscovery-input:focus {
    border-color: #cbd5e1;
    box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.03);
}

body.dark-mode .rediscovery-input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .rediscovery-input:focus {
    border-color: #475569;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}

.alert-detail-edit-container {
    margin-bottom: 1.5rem;
    width: 100%;
}

.rediscovery-input-wrapper {
    position: relative;
    width: 100%;
}

.rediscovery-input-wrapper .rediscovery-input {
    padding-right: 48px; /* Room for the buttons */
}

.rediscovery-input-wrapper .alert-edit-pencil-btn,
.rediscovery-input-wrapper .alert-save-small-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.95rem;
    padding: 6px 8px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.rediscovery-input-wrapper .alert-edit-pencil-btn {
    color: #64748b;
}

.rediscovery-input-wrapper .alert-edit-pencil-btn:hover {
    color: #475569;
    background: #f1f5f9;
}

.rediscovery-input-wrapper .alert-save-small-btn {
    color: #10b981;
}

.rediscovery-input-wrapper .alert-save-small-btn:hover {
    color: #059669;
    background: #ecfdf5;
}

.rediscovery-input-wrapper .alert-edit-pencil-btn.hidden,
.rediscovery-input-wrapper .alert-save-small-btn.hidden {
    display: none;
}

/* Dark mode overrides for input wrapper buttons */
body.dark-mode .rediscovery-input-wrapper .alert-edit-pencil-btn {
    color: #94a3b8;
}

body.dark-mode .rediscovery-input-wrapper .alert-edit-pencil-btn:hover {
    color: #f1f5f9;
    background: #1e293b;
}

body.dark-mode .rediscovery-input-wrapper .alert-save-small-btn {
    color: #34d399;
}

body.dark-mode .rediscovery-input-wrapper .alert-save-small-btn:hover {
    color: #6ee7b7;
    background: #064e3b;
}

/* Action buttons */
.alert-detail-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #f1f5f9;
}

body.dark-mode .alert-detail-actions {
    border-color: #334155;
}

.alert-action-btn {
    border: none;
    padding: 9px 16px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Outfit', sans-serif;
}

.alert-action-btn-delete {
    background: #fef2f2;
    color: #ef4444;
}

.alert-action-btn-delete:hover {
    background: #fee2e2;
    transform: translateY(-1px);
}

.alert-action-btn-search {
    background: #f1f5f9;
    color: #475569;
}

.alert-action-btn-search:hover {
    background: #e2e8f0;
    transform: translateY(-1px);
}


/* Products section */
.alert-products-section {
    margin-top: 1.5rem;
}

.alert-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

/* ===================== EMPTY STATE (NO ALERTS) ===================== */
.alerts-empty-full {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem;
    background: #ffffff;
}

.alerts-empty-icon-wrapper {
    width: 100px;
    height: 100px;
    background: #f8fafc;
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.alerts-empty-icon-wrapper i {
    font-size: 2.5rem;
    color: #cbd5e1;
}

.alerts-empty-full h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.5rem;
}

.alerts-empty-full p {
    font-size: 0.95rem;
    color: #94a3b8;
    max-width: 360px;
    line-height: 1.5;
}

.alerts-empty-hint {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 1.25rem;
    padding: 9px 18px;
    background: #f8fafc;
    border-radius: 10px;
    border: 1px solid #f1f5f9;
    color: #64748b;
    font-size: 0.85rem;
}

.alerts-empty-hint i {
    color: #94a3b8;
}

/* ===================== CUSTOM ALERT MODAL ===================== */
.alert-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(4px);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 3000;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.alert-modal-overlay.show {
    display: flex;
    opacity: 1;
}

.alert-modal-box {
    background: white;
    padding: 2rem;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    text-align: center;
}

.alert-modal-overlay.show .alert-modal-box {
    transform: scale(1);
}

.alert-modal-icon {
    width: 56px;
    height: 56px;
    background: #fef2f2;
    color: #ef4444;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin: 0 auto 1.25rem;
}

.alert-modal-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 0.6rem;
}

.alert-modal-text {
    color: #64748b;
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
}

.alert-modal-actions {
    display: flex;
    gap: 10px;
}

.alert-modal-btn {
    flex: 1;
    padding: 11px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    font-family: 'Outfit', sans-serif;
}

.alert-modal-btn-cancel {
    background: #f1f5f9;
    color: #475569;
}

.alert-modal-btn-cancel:hover {
    background: #e2e8f0;
}

.alert-modal-btn-confirm {
    background: #ef4444;
    color: white;
}

.alert-modal-btn-confirm:hover {
    background: #dc2626;
    transform: translateY(-1px);
}

/* ===================== MOBILE RESPONSIVE ===================== */
@media (max-width: 768px) {
    .alerts-page-container {
        flex-direction: column;
        height: auto;
        min-height: calc(100vh - 130px);
    }

    .alerts-sidebar {
        width: 100%;
        min-width: 100%;
        max-height: 40vh;
        border-right: none;
        border-bottom: 1px solid #e8ecf1;
    }

    .alert-detail-view {
        min-height: 60vh;
    }

    .alert-detail-content-wrapper {
        padding: 1.25rem;
    }

    .alert-detail-title-input {
        font-size: 1.2rem;
    }

    .alert-detail-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .alert-detail-header-info {
        padding-right: 0;
    }

    .alert-products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 480px) {
    .alert-products-grid {
        grid-template-columns: 1fr;
    }

    .alerts-sidebar {
        max-height: 35vh;
    }
}

/* =============================================
   DARK MODE — Alerts Page
   ============================================= */

/* Container */
body.dark-mode .alerts-page-container {
    background: #0f172a !important;
}

/* ---- Sidebar ---- */
body.dark-mode .alerts-sidebar {
    background: #1e293b;
    border-right-color: #334155;
}

body.dark-mode .alerts-sidebar-title {
    color: #f1f5f9;
}

body.dark-mode .alerts-sidebar-icon {
    background: #334155;
    color: #94a3b8;
}

body.dark-mode .alerts-count-badge {
    background: #334155;
    color: #94a3b8;
}

/* Search */
body.dark-mode .alerts-search-input {
    background: #0f172a;
    border-color: #334155;
    color: #f1f5f9;
}

body.dark-mode .alerts-search-input::placeholder {
    color: #64748b;
}

body.dark-mode .alerts-search-input:focus {
    border-color: #475569;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.03);
}

body.dark-mode .alerts-search-icon {
    color: #64748b;
}

/* List items */
body.dark-mode .alert-item:hover {
    background: #1e293b;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.dark-mode .alert-item.active {
    background: #1e293b;
    border-color: #334155;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

body.dark-mode .alert-item-prompt {
    color: #f1f5f9;
}

body.dark-mode .alert-item-time {
    color: #64748b;
}

body.dark-mode .delete-alert-small {
    color: #64748b;
}

body.dark-mode .delete-alert-small:hover {
    color: #f87171 !important;
    background: rgba(239, 68, 68, 0.15);
}

/* Scrollbar */
body.dark-mode .alerts-list-container::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.08);
}

/* ---- Detail View ---- */
body.dark-mode .alert-detail-view {
    background: #0f172a;
}

body.dark-mode .alert-detail-empty {
    color: #64748b;
}

body.dark-mode .alert-detail-empty-icon {
    background: #1e293b;
    color: #475569;
}

body.dark-mode .alert-detail-empty h3 {
    color: #94a3b8;
}

body.dark-mode .alert-detail-empty p {
    color: #64748b;
}

body.dark-mode .alert-detail-title-input {
    color: #f1f5f9;
    background: #0f172a;
    border-color: #334155;
}

body.dark-mode .alert-detail-title-input.editing {
    background: #1e293b;
    border-color: #475569;
}

body.dark-mode .edit-prompt-btn:hover {
    background: #334155;
    color: #60a5fa;
}

body.dark-mode .alert-detail-header {
    border-bottom-color: #1e293b;
}

body.dark-mode .alert-detail-meta-item {
    color: #64748b;
}

/* Action buttons */
body.dark-mode .alert-action-btn-search {
    background: #1e293b;
    color: #94a3b8;
}

body.dark-mode .alert-action-btn-search:hover {
    background: #334155;
    color: #f1f5f9;
}

body.dark-mode .alert-action-btn-delete {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
}

body.dark-mode .alert-action-btn-delete:hover {
    background: rgba(239, 68, 68, 0.25);
}


/* ---- Empty State ---- */
body.dark-mode .alerts-empty-full {
    background: #0f172a;
}

body.dark-mode .alerts-empty-icon-wrapper {
    background: #1e293b;
}

body.dark-mode .alerts-empty-icon-wrapper i {
    color: #475569;
}

body.dark-mode .alerts-empty-full h3 {
    color: #f1f5f9;
}

body.dark-mode .alerts-empty-full p {
    color: #64748b;
}

body.dark-mode .alerts-empty-hint {
    background: #1e293b;
    border-color: #334155;
    color: #94a3b8;
}

body.dark-mode .alerts-empty-hint i {
    color: #64748b;
}

/* ---- Mobile ---- */
@media (max-width: 768px) {
    body.dark-mode .alerts-sidebar {
        border-bottom-color: #334155;
    }
}