/* ============================================
   Sura Alerts - Stylesheet
   ============================================ */

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: #1a2035;
    --bg-card-hover: #1f2847;

    --text-primary: #f0f2f8;
    --text-secondary: #8b95b0;
    --text-muted: #5a6480;

    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.3);
    --accent-light: #60a5fa;

    --danger: #ef4444;
    --danger-glow: rgba(239, 68, 68, 0.3);

    --warning: #f59e0b;
    --warning-glow: rgba(245, 158, 11, 0.25);

    --success: #10b981;
    --success-glow: rgba(16, 185, 129, 0.3);

    --high: #ef4444;
    --medium: #f59e0b;
    --low: #10b981;
    --normal: #3b82f6;

    --border: rgba(255, 255, 255, 0.06);
    --border-strong: rgba(255, 255, 255, 0.12);

    --radius: 12px;
    --radius-sm: 8px;

    --font: 'IBM Plex Sans Arabic', sans-serif;

    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-glow: 0 0 40px rgba(59, 130, 246, 0.15);
}

/* ── Reset ── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    background-image:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(59, 130, 246, 0.08), transparent),
        radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.05), transparent);
}

/* ── Header ── */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 960px;
    margin: 0 auto;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--accent), #6366f1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 0 20px var(--accent-glow);
}

.logo h1 {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.3px;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Connection Status ── */
.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 100px;
    background: rgba(16, 185, 129, 0.1);
    border: 1px solid rgba(16, 185, 129, 0.2);
    font-size: 0.8rem;
    color: var(--success);
}

.connection-status.disconnected {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 2s ease-in-out infinite;
}

.disconnected .status-dot {
    background: var(--danger);
    animation: none;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ── Buttons ── */
.btn {
    padding: 8px 18px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text-secondary);
}

.btn-outline:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    border-color: var(--accent);
}

.btn-outline.muted svg {
    opacity: 0.3;
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.78rem;
}

.btn-dismiss {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

.btn-dismiss:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
    border-color: rgba(239, 68, 68, 0.3);
}

/* ── Main ── */
.main {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px;
}

/* ── Stats Bar ── */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
    transition: all 0.3s ease;
}

.stat-card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card);
}

.stat-number {
    font-size: 2rem;
    font-weight: 700;
    color: var(--accent-light);
    line-height: 1;
    margin-bottom: 6px;
}

.stat-card:first-child .stat-number {
    color: var(--success);
}

.stat-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    font-weight: 400;
}

/* ── Alerts Container ── */
.alerts-container {
    min-height: 200px;
    position: relative;
}

/* ── Empty State ── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-icon {
    margin-bottom: 16px;
    opacity: 0.25;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.88rem;
}

/* ── Alert Card ── */
.alert-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 22px;
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.alert-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    background: var(--normal);
    border-radius: 0 4px 4px 0;
}

.alert-card.priority-high::before { background: var(--high); }
.alert-card.priority-medium::before { background: var(--medium); }
.alert-card.priority-low::before { background: var(--low); }

.alert-card.priority-high {
    border-color: rgba(239, 68, 68, 0.2);
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.08);
}

.alert-card:hover {
    border-color: var(--border-strong);
    transform: translateX(-4px);
    box-shadow: var(--shadow-card);
}

/* ── Alert Pulse (للتنبيهات العاجلة) ── */
.alert-card.priority-high {
    animation: slideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1), alertPulse 3s ease-in-out infinite;
}

@keyframes alertPulse {
    0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.05); }
    50% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.15); }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-12px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.alert-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 10px;
}

.alert-subject {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.5;
    flex: 1;
}

.alert-priority {
    padding: 3px 10px;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.alert-priority.high {
    background: rgba(239, 68, 68, 0.15);
    color: var(--high);
}
.alert-priority.medium {
    background: rgba(245, 158, 11, 0.15);
    color: var(--medium);
}
.alert-priority.low {
    background: rgba(16, 185, 129, 0.15);
    color: var(--low);
}
.alert-priority.normal {
    background: rgba(59, 130, 246, 0.15);
    color: var(--normal);
}

.alert-description {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 14px;
}

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

.alert-info {
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

.alert-info-item svg {
    width: 14px;
    height: 14px;
    opacity: 0.5;
}

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

/* ── Timer ── */
.alert-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 100px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.15);
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--accent-light);
    font-variant-numeric: tabular-nums;
}

.alert-timer.expiring {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--danger);
    animation: timerPulse 1s ease-in-out infinite;
}

@keyframes timerPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.timer-icon {
    width: 14px;
    height: 14px;
}

/* ── History Section ── */
.history-section {
    margin-top: 32px;
    border-top: 1px solid var(--border);
    padding-top: 20px;
}

.history-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    padding: 8px 0;
    user-select: none;
}

.history-header h2 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.history-header .chevron {
    transition: transform 0.3s ease;
    color: var(--text-muted);
}

.history-header.open .chevron {
    transform: rotate(180deg);
}

.history-list {
    margin-top: 12px;
}

.history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 6px;
    font-size: 0.85rem;
    transition: all 0.2s ease;
}

.history-item:hover {
    background: rgba(255, 255, 255, 0.04);
}

.history-subject {
    color: var(--text-secondary);
    font-weight: 500;
    flex: 1;
}

.history-time {
    color: var(--text-muted);
    font-size: 0.78rem;
    white-space: nowrap;
    margin-right: 12px;
}

.history-badge {
    padding: 2px 8px;
    border-radius: 100px;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* ── Floating Alert ── */
.floating-alert {
    position: fixed;
    bottom: 24px;
    left: 24px;
    right: 24px;
    z-index: 1000;
    animation: floatIn 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.floating-alert-inner {
    max-width: 480px;
    margin: 0 auto;
    background: linear-gradient(135deg, #1e3a5f, #1a2035);
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 40px rgba(59, 130, 246, 0.25), 0 0 60px rgba(59, 130, 246, 0.1);
    position: relative;
    overflow: hidden;
}

.floating-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-light);
    animation: pulse-dot 1.5s ease-in-out infinite;
    flex-shrink: 0;
}

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

.floating-content strong {
    font-size: 0.92rem;
    color: var(--text-primary);
}

.floating-content span {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.floating-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.floating-close:hover {
    background: rgba(255, 255, 255, 0.2);
    color: var(--text-primary);
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ── Body Glow (عند وجود تنبيه عاجل) ── */
body.has-urgent {
    animation: bodyGlow 4s ease-in-out infinite;
}

@keyframes bodyGlow {
    0%, 100% { background-color: var(--bg-primary); }
    50% { background-color: #0f0a1a; }
}

/* ── Loading Shimmer ── */
.loading-shimmer {
    background: linear-gradient(
        90deg,
        var(--bg-card) 25%,
        var(--bg-card-hover) 50%,
        var(--bg-card) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
    height: 80px;
    margin-bottom: 12px;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Responsive ── */
@media (max-width: 640px) {
    .header-inner {
        padding: 12px 16px;
        flex-wrap: wrap;
        gap: 10px;
    }

    .logo h1 {
        font-size: 1.1rem;
    }

    .stats-bar {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    .stat-card {
        padding: 14px 10px;
    }

    .stat-number {
        font-size: 1.4rem;
    }

    .main {
        padding: 16px;
    }

    .alert-top {
        flex-direction: column;
        gap: 8px;
    }

    .alert-meta {
        flex-direction: column;
        align-items: flex-start;
    }

    .alert-info {
        flex-wrap: wrap;
    }

    .floating-alert {
        bottom: 12px;
        left: 12px;
        right: 12px;
    }

    .header-actions {
        gap: 6px;
    }
}

/* ============================================
   Sura Alerts - Settings Panel Styles
   أضف هذا المحتوى في نهاية ملف style.css
   ============================================ */

/* ── Settings Panel ── */
.settings-panel {
    position: fixed;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    width: 90%;
    max-width: 420px;
    animation: settingsIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-inner {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 60px rgba(59, 130, 246, 0.1);
}

@keyframes settingsIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0) scale(1);
    }
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.settings-header h3 {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-close {
    background: rgba(255, 255, 255, 0.06);
    border: none;
    color: var(--text-secondary);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.settings-close:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--danger);
}

/* ── Setting Group ── */
.setting-group {
    margin-bottom: 22px;
}

.setting-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.setting-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-light);
    background: rgba(59, 130, 246, 0.12);
    padding: 3px 10px;
    border-radius: 100px;
    font-variant-numeric: tabular-nums;
}

/* ── Slider ── */
.setting-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 100px;
    outline: none;
    cursor: pointer;
    transition: background 0.2s;
}

.setting-slider:hover {
    background: rgba(255, 255, 255, 0.12);
}

.setting-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
}

.setting-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 12px rgba(59, 130, 246, 0.6);
}

.setting-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    cursor: pointer;
    border: 3px solid var(--bg-card);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.setting-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* ── Setting Actions ── */
.setting-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.btn-test {
    flex: 1;
    background: rgba(59, 130, 246, 0.15);
    color: var(--accent-light);
    border: 1px solid rgba(59, 130, 246, 0.2);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-test:hover {
    background: rgba(59, 130, 246, 0.25);
}

.btn-reset {
    flex: 1;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-family: var(--font);
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-reset:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
}

/* ── Settings Overlay ── */
.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 199;
    backdrop-filter: blur(4px);
}