﻿/* ═══════════════════════════════════════════════════════════════
   PashaMail — app.css
   Responsive: 300px → ∞
   ═══════════════════════════════════════════════════════════════ */

/* ── CSS Variables ── */
:root,
[data-bs-theme="light"],
.light-mode {
    --pm-bg: #f0f2f5;
    --pm-surface: #ffffff;
    --pm-surface-2: #f7f8fa;
    --pm-border: #e2e6ea;
    --pm-text: #1a1d26;
    --pm-text-2: #64748b;
    --pm-accent: #6366f1;
    --pm-accent-hover: #4f46e5;
    --pm-accent-subtle: rgba(99, 102, 241, 0.1);
    --pm-success: #10b981;
    --pm-danger: #ef4444;
    --pm-warning: #f59e0b;
    --pm-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --pm-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
    --pm-radius: 12px;
    --pm-radius-sm: 8px;
    --pm-radius-xs: 6px;
    /* compatibility مع app.css القديم */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --neon-blue: #6366f1;
    --text-primary: #1a1d26;
    --card-radius: 12px;
    --transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    background: radial-gradient(circle at bottom left, #f8fafc, #e2e8f0);
}

[data-bs-theme="dark"],
.dark-mode {
    --pm-bg: #0a0e1a;
    --pm-surface: #131829;
    --pm-surface-2: #1a2035;
    --pm-border: #252d44;
    --pm-text: #e2e8f0;
    --pm-text-2: #8892a8;
    --pm-accent: #818cf8;
    --pm-accent-hover: #6366f1;
    --pm-accent-subtle: rgba(129, 140, 248, 0.12);
    --pm-success: #34d399;
    --pm-danger: #f87171;
    --pm-warning: #fbbf24;
    --pm-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --pm-shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(15, 23, 42, 0.8);
    --neon-blue: #818cf8;
    --text-primary: #f8fafc;
    background: radial-gradient(circle at top right, #1e293b, #0f172a);
}

/* ── Global Reset ── */
*,
*::before,
*::after {
    box-sizing: border-box;
}

body {
    color: var(--pm-text);
    transition: var(--transition);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--pm-border);
    border-radius: 3px;
}

    ::-webkit-scrollbar-thumb:hover {
        background: var(--pm-text-2);
    }

/* ═══════════════════════════════════════════════════════════════
   APP WRAPPER
   ═══════════════════════════════════════════════════════════════ */

.pm-app {
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--pm-bg);
    color: var(--pm-text);
    display: flex;
    flex-direction: column;
}

.pm-container {
    width: 100%;
    max-width: 1320px;
    margin: 0 auto;
    padding: 0 clamp(0.5rem, 3vw, 1.5rem);
}

/* ═══════════════════════════════════════════════════════════════
   NAVBAR
   ═══════════════════════════════════════════════════════════════ */

.pm-navbar {
    background: var(--pm-surface);
    border-bottom: 1px solid var(--pm-border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

.pm-nav-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: clamp(52px, 8vh, 72px);
    gap: 0.75rem;
}

.pm-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--pm-text);
    flex-shrink: 0;
}

.pm-brand-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, var(--pm-accent), #a78bfa);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1rem;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.pm-brand-text {
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    letter-spacing: -0.02em;
    white-space: nowrap;
}

    .pm-brand-text strong {
        color: var(--pm-accent);
    }

.pm-nav-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.pm-btn-icon {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--pm-border);
    background: var(--pm-surface-2);
    color: var(--pm-text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    flex-shrink: 0;
}

    .pm-btn-icon:hover {
        border-color: var(--pm-accent);
        color: var(--pm-accent);
        background: var(--pm-accent-subtle);
    }

.pm-lang-badge {
    font-size: 0.7rem;
    font-weight: 700;
}

/* ═══════════════════════════════════════════════════════════════
   MAIN LAYOUT
   ═══════════════════════════════════════════════════════════════ */

.pm-main {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 1.25rem;
    padding-top: 1.25rem;
    padding-bottom: 2rem;
    align-items: start;
    flex: 1;
}
/* منع العناصر من "الارتجاج" عند ظهور الصور */
.pm-main img {
    font-size: 0; /* منع ظهور مسافات فارغة تحت الصور */
    height: auto;
}
/* ═══════════════════════════════════════════════════════════════
   CARDS
   ═══════════════════════════════════════════════════════════════ */

.pm-card {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
    box-shadow: var(--pm-shadow);
    overflow: hidden;
}

.pm-card-header {
    padding: 0.875rem 1rem;
    font-weight: 700;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--pm-text);
    border-bottom: 1px solid var(--pm-border);
}

    .pm-card-header i {
        color: var(--pm-accent);
    }

.pm-card-body {
    padding: 1rem;
}

/* ═══════════════════════════════════════════════════════════════
   INPUTS
   ═══════════════════════════════════════════════════════════════ */

.pm-input-row {
    display: flex;
    gap: 0;
    margin-bottom: 0.75rem;
}

.pm-input,
.pm-select {
    flex: 1;
    height: 42px;
    padding: 0 0.75rem;
    background: var(--pm-surface-2);
    border: 1px solid var(--pm-border);
    color: var(--pm-text);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 0;
}

    .pm-input::placeholder {
        color: var(--pm-text-2);
        opacity: 0.7;
    }

    .pm-input:focus,
    .pm-select:focus {
        border-color: var(--pm-accent);
        box-shadow: 0 0 0 3px var(--pm-accent-subtle);
        z-index: 1;
    }

.pm-input-prefix {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    background: var(--pm-accent-subtle);
    border: 1px solid var(--pm-border);
    border-right: none;
    border-radius: var(--pm-radius-xs) 0 0 var(--pm-radius-xs);
    color: var(--pm-accent);
    font-weight: 700;
    font-size: 0.95rem;
}

    .pm-input-prefix + .pm-select {
        border-radius: 0 var(--pm-radius-xs) var(--pm-radius-xs) 0;
    }

.pm-input-row:has(.pm-input) .pm-input {
    border-radius: var(--pm-radius-xs) 0 0 var(--pm-radius-xs);
}

.pm-btn-dice {
    width: 40px;
    min-width: 40px;
    height: 42px;
    border: 1px solid var(--pm-border);
    border-left: none;
    border-radius: 0 var(--pm-radius-xs) var(--pm-radius-xs) 0;
    background: var(--pm-surface-2);
    color: var(--pm-text-2);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .pm-btn-dice:hover {
        color: var(--pm-accent);
        background: var(--pm-accent-subtle);
    }

/* ═══════════════════════════════════════════════════════════════
   PRIMARY BUTTON
   ═══════════════════════════════════════════════════════════════ */

.pm-btn-primary {
    height: 44px;
    padding: 0 1.5rem;
    border: none;
    border-radius: var(--pm-radius-xs);
    background: linear-gradient(135deg, var(--pm-accent), #8b5cf6);
    color: #fff;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.25s;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    width: 100%;
}

    .pm-btn-primary:hover:not(:disabled) {
        transform: translateY(-1px);
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    }

    .pm-btn-primary:active:not(:disabled) {
        transform: translateY(0);
    }

    .pm-btn-primary:disabled,
    .pm-btn-primary.loading {
        opacity: 0.65;
        cursor: not-allowed;
        transform: none;
    }

/* ═══════════════════════════════════════════════════════════════
   ERROR MESSAGE
   ═══════════════════════════════════════════════════════════════ */

.pm-error-msg {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: var(--pm-radius-xs);
    color: var(--pm-danger);
    font-size: 0.8rem;
    font-weight: 600;
    text-align: center;
    animation: shakeX 0.4s ease;
}

@keyframes shakeX {
    0%, 100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-4px);
    }

    40% {
        transform: translateX(4px);
    }

    60% {
        transform: translateX(-3px);
    }

    80% {
        transform: translateX(3px);
    }
}

/* ═══════════════════════════════════════════════════════════════
   INBOX LIST
   ═══════════════════════════════════════════════════════════════ */

.pm-inbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.pm-inbox-item {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

    .pm-inbox-item:hover {
        border-color: var(--pm-accent);
        box-shadow: 0 2px 8px rgba(99, 102, 241, 0.1);
        transform: translateX(-2px);
    }

    .pm-inbox-item.active {
        background: linear-gradient(135deg, var(--pm-accent), #8b5cf6);
        border-color: transparent;
        color: #fff;
        box-shadow: 0 4px 16px rgba(99, 102, 241, 0.3);
        transform: scale(1.02);
    }

.pm-inbox-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    background: var(--pm-accent-subtle);
    color: var(--pm-accent);
}

.pm-inbox-item.active .pm-inbox-icon {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
}

.pm-inbox-info {
    flex: 1;
    min-width: 0;
}

.pm-inbox-email {
    font-weight: 700;
    font-size: 0.8rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-inbox-timer {
    font-size: 0.7rem;
    opacity: 0.65;
    margin-top: 2px;
}

    .pm-inbox-timer i {
        margin-inline-end: 3px;
    }

.pm-inbox-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.pm-badge-count {
    min-width: 24px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pm-accent-subtle);
    color: var(--pm-accent);
}

    .pm-badge-count.active {
        background: rgba(255, 255, 255, 0.25);
        color: #fff;
    }

.pm-btn-delete {
    background: none;
    border: none;
    color: var(--pm-text-2);
    cursor: pointer;
    font-size: 0.75rem;
    padding: 2px 4px;
    border-radius: 4px;
    transition: all 0.2s;
    opacity: 0.5;
}

    .pm-btn-delete:hover {
        color: var(--pm-danger);
        opacity: 1;
    }

.pm-inbox-item.active .pm-btn-delete {
    color: rgba(255, 255, 255, 0.5);
}

    .pm-inbox-item.active .pm-btn-delete:hover {
        color: #fca5a5;
    }

/* ═══════════════════════════════════════════════════════════════
   MAIL CARD
   ═══════════════════════════════════════════════════════════════ */

.pm-mail-card {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.pm-mail-header {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--pm-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.pm-mail-header-left {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    flex-wrap: wrap;
    min-width: 0;
}

.pm-mail-address-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.pm-mail-address {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--pm-text);
    user-select: all;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pm-btn-copy {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--pm-border);
    border-radius: 20px;
    background: var(--pm-surface-2);
    color: var(--pm-text-2);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

    .pm-btn-copy:hover {
        border-color: var(--pm-accent);
        color: var(--pm-accent);
        background: var(--pm-accent-subtle);
    }

    .pm-btn-copy.copied {
        border-color: var(--pm-success);
        color: var(--pm-success);
        background: rgba(16, 185, 129, 0.1);
    }

.pm-sync-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.1);
    color: var(--pm-success);
    font-size: 0.7rem;
    font-weight: 600;
    flex-shrink: 0;
}

.pm-sync-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pm-success);
    animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
    0%, 100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

.pm-msg-count {
    font-size: 0.78rem;
    color: var(--pm-text-2);
    font-weight: 500;
    flex-shrink: 0;
}

.pm-mail-body {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 300px;
    max-height: calc(100dvh - 250px);
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGE LIST
   ═══════════════════════════════════════════════════════════════ */

.pm-msg-list {
    display: flex;
    flex-direction: column;
}

.pm-msg-item {
    border-bottom: 1px solid var(--pm-border);
    transition: background 0.15s;
}

    .pm-msg-item:hover {
        background: var(--pm-surface-2);
    }

/* --- الرسالة غير المقروءة (Unread) --- */
.pm-msg-item.unread {
    font-weight: 800 !important;
    border-right: 4px solid var(--pasha-main); /* خط جانبي يميزها */
    background-color: var(--bs-body-bg);
}

        .pm-msg-item.unread:hover {
            background: rgba(99, 102, 241, 0.08);
        }

.pm-msg-summary {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.875rem 1rem;
    cursor: pointer;
}

.pm-msg-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    background: var(--pm-surface-2);
    color: var(--pm-text-2);
}

.pm-msg-item.unread .pm-msg-icon {
    background: var(--pm-accent-subtle);
    color: var(--pm-accent);
}

.pm-msg-meta {
    flex: 1;
    min-width: 0;
}

.pm-msg-subject {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--pm-text);
}

.pm-msg-item.unread .pm-msg-subject {
    color: var(--bs-emphasis-color);
}
.pm-msg-item.unread .pm-msg-icon i {
    color: var(--pasha-main) !important;
}
.pm-msg-sender {
    font-size: 0.73rem;
    color: var(--pm-text-2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.pm-msg-time {
    font-size: 0.7rem;
    color: var(--pm-text-2);
    white-space: nowrap;
    flex-shrink: 0;
}

.pm-msg-chevron {
    color: var(--pm-text-2);
    font-size: 0.7rem;
    flex-shrink: 0;
    transition: transform 0.2s;
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGE DETAIL
   ═══════════════════════════════════════════════════════════════ */

.pm-msg-detail {
    padding: 0 1rem 1rem;
    animation: slideDown 0.25s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pm-msg-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 0.875rem;
    margin-bottom: 0.75rem;
    background: var(--pm-surface-2);
    border-radius: var(--pm-radius-xs);
    border: 1px solid var(--pm-border);
    gap: 1rem;
}

.pm-detail-label {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--pm-text-2);
    margin-bottom: 2px;
}

.pm-detail-value {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--pm-text);
    word-break: break-word;
}

/* ═══════════════════════════════════════════════════════════════
   MESSAGE BODY (آمن — XSS Protected)
   ═══════════════════════════════════════════════════════════════ */

.pm-msg-body {
    padding: 1rem;
    background: var(--pm-surface-2);
    border-radius: var(--pm-radius-xs);
    border: 1px solid var(--pm-border);
    font-size: 0.875rem;
    color: var(--pm-text);
    overflow-x: auto;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.pm-msg-text {
    line-height: 1.85;
    font-size: 0.875rem;
    word-break: break-word;
    color: var(--pm-text);
}

.pm-msg-link {
    color: var(--pm-accent) !important;
    text-decoration: underline;
    word-break: break-all;
    transition: opacity 0.2s;
}

    .pm-msg-link:hover {
        opacity: 0.75;
    }

.pm-empty-body {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--pm-text-2);
    font-style: italic;
    font-size: 0.85rem;
}

/* ═══════════════════════════════════════════════════════════════
   EMPTY INBOX
   ═══════════════════════════════════════════════════════════════ */

.pm-empty-inbox {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--pm-text-2);
}

.pm-empty-pulse {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--pm-accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--pm-accent);
    margin-bottom: 1.25rem;
    animation: pulse-ring 2.5s infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.3);
    }

    70% {
        box-shadow: 0 0 0 20px rgba(99, 102, 241, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

.pm-empty-inbox h5 {
    font-weight: 700;
    color: var(--pm-text);
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
}

.pm-empty-inbox p {
    font-size: 0.8rem;
    max-width: 260px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   PLACEHOLDER (لا يوجد صندوق محدد)
   ═══════════════════════════════════════════════════════════════ */

.pm-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    text-align: center;
    color: var(--pm-text-2);
    padding: 2rem 1rem;
}

.pm-placeholder-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--pm-accent-subtle);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--pm-accent);
    margin-bottom: 1.25rem;
    opacity: 0.5;
}

.pm-placeholder h4 {
    font-weight: 700;
    color: var(--pm-text);
    margin-bottom: 0.5rem;
    font-size: 1rem;
}

.pm-placeholder p {
    font-size: 0.8rem;
    max-width: 260px;
    line-height: 1.5;
}

/* ═══════════════════════════════════════════════════════════════
   AD SLOTS
   ═══════════════════════════════════════════════════════════════ */

/* حجز مساحة إعلان البانر العلوي (الأكثر تأثيراً على الـ CLS) */
.pm-ad-slot {
    display: block;
    min-height: 100px; /* زيادة الهامش لضمان عدم القفز */
    background-color: var(--pm-surface-2);
    border: 1px solid var(--pm-border);
    margin-bottom: 20px;
    position: relative;
}

.pm-ad-header {
    min-width: 200px;
    max-width: 468px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pm-surface-2);
    border: 1px dashed var(--pm-border);
    border-radius: var(--pm-radius-xs);
}

.pm-ad-banner {
    margin: 0.75rem 0;
    min-height: 250px; /* أو حسب مقاس الإعلان اللي بيظهر عندك */
    background: rgba(128, 128, 128, 0.05); /* خلفية خفيفة بتبين إن فيه حاجة هتحمل هنا */
    display: flex;
    align-items: center;
    justify-content: center;
    /* background: var(--pm-surface); */
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius);
}

/* حجز مساحة إعلان السايدبار الطويل */
.pm-ad-sidebar {
    min-height: 600px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

.pm-ad-inline {
    margin-bottom: 0.75rem;
    min-height: 90px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: var(--pm-radius-xs);
}

/* ═══════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════ */

.pm-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.625rem 1.25rem;
    border-radius: 50px;
    font-size: 0.8rem;
    font-weight: 600;
    z-index: 9999;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    animation: toastIn 0.35s ease, toastOut 0.3s ease 2.2s forwards;
    white-space: nowrap;
    max-width: calc(100vw - 2rem);
}

.toast-success {
    background: var(--pm-success);
    color: #fff;
}

.toast-error {
    background: var(--pm-danger);
    color: #fff;
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(10px);
    }
}

/* ═══════════════════════════════════════════════════════════════
   AD-BLOCKER MODAL
   ═══════════════════════════════════════════════════════════════ */

.adblock-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.adblock-card {
    background: var(--pm-surface);
    border: 1px solid var(--pm-border);
    border-radius: 20px;
    padding: 2.5rem 2rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.3s ease;
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.adblock-icon {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: rgba(245, 158, 11, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    color: var(--pm-warning);
    margin: 0 auto 1.25rem;
}

.adblock-title {
    font-weight: 800;
    font-size: 1.2rem;
    color: var(--pm-text);
    margin-bottom: 0.625rem;
}

.adblock-msg {
    color: var(--pm-text-2);
    font-size: 0.85rem;
    margin-bottom: 1.75rem;
    line-height: 1.6;
}

.adblock-btn {
    padding: 0.75rem 2rem;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--pm-accent), #8b5cf6);
    color: #fff;
    font-weight: 700;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s;
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

    .adblock-btn:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 24px rgba(99, 102, 241, 0.45);
    }

/* ═══════════════════════════════════════════════════════════════
   FOOTER
   ═══════════════════════════════════════════════════════════════ */

.pm-footer {
    padding: 30px 0; /* زيادة المسافة الرأسية */
    margin-top: 50px;
    border-top: 1px solid var(--bs-border-color-translucent);
    opacity: 0.8;
}

.pm-footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.pm-social-link {
    text-decoration: none;
    color: var(--bs-body-color);
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    padding: 5px 12px;
    background: rgba(13, 110, 253, 0.05); /* خلفية خفيفة جداً */
    border-radius: 20px;
    transition: all 0.3s ease;
}

    .pm-social-link i {
        font-size: 1.1rem;
        color: #1877F2; /* لون فيسبوك الرسمي */
    }

    .pm-social-link:hover {
        background: #1877F2;
        color: white !important;
        transform: translateY(-2px);
    }

        .pm-social-link:hover i {
            color: white !important;
        }

/* للموبايل: نخلي الفوتر يترتب فوق بعضه */
@media (max-width: 576px) {
    .pm-footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

.pm-footer-dot {
    opacity: 0.4;
}

/* ═══════════════════════════════════════════════════════════════
   RTL / LTR
   ═══════════════════════════════════════════════════════════════ */

.dir-rtl {
    direction: rtl;
    text-align: right;
}

.dir-ltr {
    direction: ltr;
    text-align: left;
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Tablet (≤991px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 991px) {
    .pm-main {
        grid-template-columns: 1fr;
    }

    .pm-sidebar {
        order: 1;
    }

    .pm-content {
        order: 2;
    }

    .pm-mail-body {
        max-height: calc(100dvh - 300px);
        min-height: 250px;
    }

    .pm-inbox-list {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
        gap: 0.5rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Mobile (≤767px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 767px) {
    .pm-nav-inner {
        height: 52px;
    }

    .pm-brand-icon {
        width: 32px;
        height: 32px;
        font-size: 0.85rem;
    }

    .pm-main {
        gap: 1rem;
        padding-top: 1rem;
    }

    .pm-card-body {
        padding: 0.875rem;
    }

    .pm-mail-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .pm-mail-header-right {
        width: 100%;
    }

    .pm-msg-detail-header {
        flex-direction: column;
        gap: 0.625rem;
    }

    .pm-msg-summary {
        padding: 0.75rem;
        gap: 0.5rem;
    }
    /* --- الرسالة المقروءة (Read) --- */
    /* الرسالة المقروءة: باهتة قليلاً وأيقونة مفتوحة */
    .pm-msg-item.read {
        font-weight: 400 !important;
        opacity: 0.85;
        background-color: rgba(128, 128, 128, 0.03);
    }

    .pm-msg-item.read .pm-msg-icon i {
        color: #6c757d !important;
    }
    /* تحسين شكل الأيقونات */
    .pm-msg-icon {
        width: 40px;
        font-size: 1.2rem;
        display: flex;
        justify-content: center;
    }

    .pm-msg-subject {
        font-size: 0.8rem;
    }

    .pm-msg-sender {
        font-size: 0.68rem;
    }

    .pm-inbox-list {
        grid-template-columns: 1fr;
    }

    .pm-inbox-item {
        padding: 0.625rem;
    }

    .pm-inbox-icon {
        width: 34px;
        height: 34px;
        min-width: 34px;
        font-size: 0.8rem;
    }

    .pm-empty-inbox,
    .pm-placeholder {
        min-height: 300px;
        padding: 2rem 1rem;
    }

    .pm-empty-pulse {
        width: 60px;
        height: 60px;
        font-size: 1.5rem;
    }

    .pm-placeholder-icon {
        width: 64px;
        height: 64px;
        font-size: 1.5rem;
    }

    .adblock-card {
        padding: 2rem 1.5rem;
        border-radius: 16px;
    }

    .adblock-icon {
        width: 56px;
        height: 56px;
        font-size: 1.4rem;
    }

    .pm-toast {
        bottom: 1rem;
        font-size: 0.75rem;
        padding: 0.5rem 1rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Small Mobile (≤480px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 480px) {
    .pm-container {
        padding: 0 0.75rem;
    }

    .pm-brand-text {
        font-size: 0.95rem;
    }

    .pm-btn-icon {
        width: 32px;
        height: 32px;
        font-size: 0.75rem;
    }

    .pm-input,
    .pm-select {
        height: 38px;
        font-size: 0.8rem;
        padding: 0 0.625rem;
    }

    .pm-input-prefix {
        width: 36px;
        min-width: 36px;
        font-size: 0.85rem;
    }

    .pm-btn-dice {
        width: 36px;
        min-width: 36px;
        height: 38px;
    }

    .pm-btn-primary {
        height: 40px;
        font-size: 0.8rem;
    }

    .pm-card-header {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .pm-msg-body {
        padding: 0.75rem;
        font-size: 0.8rem;
    }

    .pm-msg-text {
        font-size: 0.8rem;
        line-height: 1.7;
    }

    .pm-mail-address {
        font-size: 0.8rem;
    }

    .pm-btn-copy {
        padding: 0.25rem 0.5rem;
        font-size: 0.65rem;
    }

    .pm-sync-badge {
        padding: 0.15rem 0.5rem;
        font-size: 0.65rem;
    }

    .pm-msg-count {
        font-size: 0.7rem;
    }

    .pm-inbox-email {
        font-size: 0.75rem;
    }

    .pm-inbox-timer {
        font-size: 0.65rem;
    }

    .pm-badge-count {
        font-size: 0.65rem;
        min-width: 20px;
        height: 18px;
    }

    .pm-footer-inner {
        font-size: 0.68rem;
    }

    .adblock-title {
        font-size: 1rem;
    }

    .adblock-msg {
        font-size: 0.78rem;
    }

    .adblock-btn {
        padding: 0.625rem 1.5rem;
        font-size: 0.8rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Tiny Screens (≤360px)
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 360px) {
    .pm-container {
        padding: 0 0.5rem;
    }

    .pm-brand-icon {
        width: 28px;
        height: 28px;
        font-size: 0.75rem;
        border-radius: 8px;
    }

    .pm-brand-text {
        font-size: 0.85rem;
    }

    .pm-nav-inner {
        height: 48px;
        gap: 0.4rem;
    }

    .pm-btn-icon {
        width: 30px;
        height: 30px;
        font-size: 0.7rem;
    }

    .pm-input,
    .pm-select {
        height: 36px;
        font-size: 0.75rem;
    }

    .pm-btn-primary {
        height: 38px;
        font-size: 0.75rem;
    }

    .pm-card-header {
        padding: 0.625rem;
        font-size: 0.75rem;
        gap: 0.3rem;
    }

    .pm-msg-summary {
        padding: 0.625rem;
        gap: 0.4rem;
    }

    .pm-msg-icon {
        width: 28px;
        height: 28px;
        min-width: 28px;
        font-size: 0.7rem;
    }

    .pm-msg-subject {
        font-size: 0.75rem;
    }

    .pm-msg-sender {
        font-size: 0.62rem;
    }

    .pm-msg-time {
        font-size: 0.62rem;
    }

    .pm-msg-chevron {
        font-size: 0.6rem;
    }

    .pm-msg-body {
        padding: 0.625rem;
        font-size: 0.75rem;
    }

    .pm-msg-text {
        font-size: 0.75rem;
    }

    .pm-detail-label {
        font-size: 0.6rem;
    }

    .pm-detail-value {
        font-size: 0.75rem;
    }

    .pm-inbox-email {
        font-size: 0.7rem;
    }

    .pm-inbox-timer {
        font-size: 0.6rem;
    }

    .pm-inbox-icon {
        width: 30px;
        height: 30px;
        min-width: 30px;
        font-size: 0.7rem;
    }

    .pm-badge-count {
        font-size: 0.6rem;
        min-width: 18px;
        height: 16px;
    }

    .pm-empty-inbox h5 {
        font-size: 0.85rem;
    }

    .pm-empty-inbox p {
        font-size: 0.72rem;
    }

    .pm-placeholder h4 {
        font-size: 0.85rem;
    }

    .pm-placeholder p {
        font-size: 0.72rem;
    }

    .pm-footer-inner {
        font-size: 0.6rem;
    }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE — Ultra-Wide (>1400px)
   ═══════════════════════════════════════════════════════════════ */

@media (min-width: 1400px) {
    .pm-main {
        grid-template-columns: 380px 1fr;
    }

    .pm-mail-body {
        max-height: calc(100dvh - 220px);
    }
}
/* ═══════════════════════════════════════════════════════════════
   EMAIL HTML RENDER — Professional Display
   ═══════════════════════════════════════════════════════════════ */

.pm-email-render {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--pm-text);
    word-break: break-word;
    overflow-wrap: break-word;
}

    /* النصوص */
    .pm-email-render p {
        margin: 0 0 0.75em 0;
        line-height: 1.7;
    }

    .pm-email-render h1,
    .pm-email-render h2,
    .pm-email-render h3,
    .pm-email-render h4 {
        margin: 1em 0 0.5em 0;
        line-height: 1.3;
        color: var(--pm-text);
    }

    /* الجداول */
    .pm-email-render table {
        max-width: 100%;
        border-collapse: collapse;
        margin: 0.5em 0;
        font-size: inherit;
    }

    .pm-email-render td,
    .pm-email-render th {
        padding: 6px 10px;
        vertical-align: top;
    }

    /* الروابط */
    .pm-email-render a {
        color: var(--pm-accent) !important;
        text-decoration: underline;
        word-break: break-all;
        transition: opacity 0.2s;
    }

        .pm-email-render a:hover {
            opacity: 0.8;
        }

    /* الصور */
    .pm-email-render img {
        max-width: 100% !important;
        height: auto !important;
        display: block;
        margin: 8px 0;
        border-radius: 6px;
    }

    /* القوائم */
    .pm-email-render ul,
    .pm-email-render ol {
        margin: 0.5em 0;
        padding-inline-start: 1.5em;
    }

    .pm-email-render li {
        margin-bottom: 0.25em;
    }

    /* الأكواد */
    .pm-email-render code {
        background: var(--pm-surface);
        border: 1px solid var(--pm-border);
        padding: 0.15em 0.4em;
        border-radius: 4px;
        font-size: 0.85em;
        font-family: 'Fira Code', 'Consolas', monospace;
    }

    .pm-email-render pre {
        background: var(--pm-surface);
        border: 1px solid var(--pm-border);
        padding: 0.75rem;
        border-radius: 6px;
        overflow-x: auto;
        font-size: 0.82rem;
    }

    /* الحواشي والفاصل */
    .pm-email-render hr {
        border: none;
        border-top: 1px solid var(--pm-border);
        margin: 1em 0;
    }

    /* النص المنسق */
    .pm-email-render strong,
    .pm-email-render b {
        font-weight: 700;
    }

    .pm-email-render em,
    .pm-email-render i {
        font-style: italic;
    }

    /* الـ div/table اللي فيها خلفية ملونة */
    .pm-email-render [style*="background"] {
        border-radius: 6px;
    }

    /* Unsubscribe links */
    .pm-email-render a[href*="unsubscribe"] {
        color: var(--pm-text-2) !important;
        font-size: 0.78rem;
        opacity: 0.7;
    }

        .pm-email-render a[href*="unsubscribe"]:hover {
            opacity: 1;
        }

/* ═══════════════════════════════════════════════════════════════
   COMPATIBILITY — Legacy classes from old app.css
   ═══════════════════════════════════════════════════════════════ */

.glass-header {
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    background: var(--glass-bg);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.futuristic-card {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: var(--card-radius);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--pm-shadow-lg);
}

.inbox-item {
    padding: 15px;
    margin-bottom: 10px;
    cursor: pointer;
    border-radius: var(--pm-radius-sm);
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--glass-bg);
    border: 1px solid var(--pm-border);
}

    .inbox-item.active {
        background: linear-gradient(135deg, var(--pm-accent), #8b5cf6);
        color: white;
        transform: scale(1.02);
        border-color: transparent;
    }

.message-row {
    margin: 8px;
    padding: 12px;
    border-radius: var(--pm-radius-sm);
    transition: var(--transition);
    border: 1px solid var(--pm-border);
}

    .message-row.unread {
        background: var(--pm-accent-subtle);
        border-left: 4px solid var(--pm-accent);
        font-weight: 700 !important;
    }

    .message-row.read {
        background: transparent;
        opacity: 0.7;
        font-weight: 400 !important;
    }

.btn-generate {
    background: linear-gradient(135deg, var(--pm-accent), #8b5cf6);
    border: none;
    border-radius: var(--pm-radius-xs);
    padding: 12px;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.3);
    cursor: pointer;
    transition: all 0.25s;
}

    .btn-generate:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
    }

.ai-loader {
    width: 50px;
    height: 50px;
    border: 3px solid var(--pm-accent);
    border-radius: 50%;
    border-top-color: transparent;
    animation: rotate 1s infinite linear;
    margin: 0 auto 15px;
}

@keyframes rotate {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY
   ═══════════════════════════════════════════════════════════════ */

.cursor-pointer {
    cursor: pointer;
}

.pe-none {
    pointer-events: none;
}

.user-select-none {
    user-select: none;
}

.opacity-25 {
    opacity: 0.25;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

/* ═══════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════ */

@media print {
    .pm-navbar,
    .pm-sidebar,
    .pm-footer,
    .pm-ad-slot,
    .pm-toast,
    .adblock-overlay {
        display: none !important;
    }

    .pm-main {
        grid-template-columns: 1fr;
    }

    .pm-mail-body {
        max-height: none;
        overflow: visible;
    }
}

.support-card {
    background: var(--ad-card-bg, #ffffff);
    overflow: hidden;
}

.support-header {
    background: linear-gradient(135deg, #6366f1 0%, #4f46e5 100%);
    color: white;
}

    .support-header p {
        color: rgba(255, 255, 255, 0.8) !important;
    }

.form-control:focus, .form-select:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 0.25rem rgba(99, 102, 241, 0.25);
}

/* ═══════════════════════════════════════════════════════════════
   PROFESSIONAL FOOTER THEME FIX (Brand & Copy)
   ═══════════════════════════════════════════════════════════════ */

/* 1. استهداف اسم الموقع (PashaMail) */
.pm-footer .footer-brand span {
    color: var(--pm-text) !important; /* يقرأ اللون الأساسي لكل وضع */
}

/* 2. استهداف النصوص الفرعية (Footer Copy) ومنع اختفائها */
.pm-footer .footer-copy,
.pm-footer .footer-copy p {
    color: var(--pm-text) !important;
    opacity: 0.85; /* تعطي طابعاً هادئاً لكن مقروء */
}

/* 3. "القاضية" لوضع اللايت مود لضمان سكور 100% في التباين */
[data-bs-theme="light"] .pm-footer .footer-brand span {
    color: #919ec4 !important; /* فرض اللون الداكن الصريح من متغيراتك */
}

[data-bs-theme="light"] .pm-footer .footer-copy,
[data-bs-theme="light"] .pm-footer .footer-copy p,
[data-bs-theme="light"] .pm-footer .text-muted {
    color: #334155 !important; /* لون Slate داكن يضمن تجاوز اختبار جوجل */
    opacity: 1 !important;
}

/* 4. تعديل أيقونة الصاعقة لتناسب لون هويتك */
.footer-brand i.fa-bolt {
    color: var(--pm-accent) !important;
}