/* ═══════════════════════════════════════════════════════════════
   OsosMail - Modern Temporary Email UI
   ═══════════════════════════════════════════════════════════════ */

:root {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #2d3a4f;
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --accent-light: rgba(59, 130, 246, 0.15);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #22c55e;
    --border: #2d3a4f;
    --border-light: #374151;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.2);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --transition: all 0.2s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    direction: rtl;
}

/* ─── App Container ──────────────────────────────────────────── */

.app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ─── Header ─────────────────────────────────────────────────── */

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    margin-bottom: 24px;
}

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

.logo-icon {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
}

.logo h1 {
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

/* ─── Email Section ──────────────────────────────────────────── */

.email-section {
    text-align: center;
    margin-bottom: 20px;
    position: relative;
}

.email-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.email-display {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    border: 2px solid var(--accent);
    border-radius: var(--radius);
    padding: 14px 24px;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.15);
    transition: var(--transition);
}

.email-display:hover {
    box-shadow: 0 0 30px rgba(59, 130, 246, 0.25);
}

.email-text {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.2rem;
    font-weight: 500;
    color: var(--text-primary);
    letter-spacing: 0.5px;
    direction: ltr;
}

.btn-icon {
    background: var(--bg-tertiary);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.btn-icon:hover {
    background: var(--accent);
    color: white;
}

.copy-toast {
    position: absolute;
    bottom: -35px;
    left: 50%;
    transform: translateX(-50%) translateY(10px);
    background: var(--success);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ─── Action Buttons ─────────────────────────────────────────── */

.actions {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-hover);
    transform: translateY(-1px);
}

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

.btn-danger:hover {
    background: var(--danger);
    color: white;
    transform: translateY(-1px);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

/* ─── Auto Refresh ───────────────────────────────────────────── */

.auto-refresh {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

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

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

.countdown {
    background: var(--bg-tertiary);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    min-width: 24px;
    text-align: center;
}

/* ─── Main Content ───────────────────────────────────────────── */

.main-content {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 16px;
    flex: 1;
    min-height: 450px;
}

/* ─── Email List ─────────────────────────────────────────────── */

.email-list {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow-y: auto;
    max-height: 500px;
}

.email-item {
    padding: 14px 18px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.email-item:hover {
    background: var(--bg-hover);
}

.email-item.active {
    background: var(--accent-light);
    border-right: 3px solid var(--accent);
}

.email-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.email-sender {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
}

.email-time {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    direction: ltr;
}

.email-subject {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-preview {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.email-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ─── Empty State ────────────────────────────────────────────── */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    padding: 40px;
    text-align: center;
}

.empty-icon {
    margin-bottom: 16px;
    color: var(--text-muted);
}

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

.empty-subtitle {
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ─── Email Viewer ───────────────────────────────────────────── */

.email-viewer {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.viewer-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    min-height: 300px;
    color: var(--text-muted);
    gap: 12px;
}

.viewer-placeholder p {
    font-size: 0.9rem;
}

.viewer-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.viewer-subject {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.viewer-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    flex-wrap: wrap;
    gap: 8px;
}

.viewer-sender {
    font-size: 0.85rem;
    color: var(--text-secondary);
    direction: ltr;
    text-align: left;
}

.viewer-sender strong {
    color: var(--text-primary);
}

.viewer-time {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.viewer-actions {
    display: flex;
    gap: 8px;
}

.viewer-body {
    flex: 1;
    padding: 20px 24px;
    overflow-y: auto;
    max-height: 400px;
}

.email-iframe {
    width: 100%;
    min-height: 300px;
    border: none;
    background: white;
    border-radius: var(--radius-sm);
}

.email-text-body {
    font-family: 'Cairo', sans-serif;
    font-size: 0.9rem;
    line-height: 1.8;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ─── Footer ─────────────────────────────────────────────────── */

.footer {
    text-align: center;
    padding: 20px 0;
    margin-top: 24px;
    color: var(--text-muted);
    font-size: 0.8rem;
    border-top: 1px solid var(--border);
}

/* ─── Responsive ─────────────────────────────────────────────── */

@media (max-width: 768px) {
    .app-container {
        padding: 12px;
    }
    
    .header {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    
    .email-text {
        font-size: 0.95rem;
    }
    
    .email-display {
        padding: 10px 16px;
    }
    
    .main-content {
        grid-template-columns: 1fr;
    }
    
    .email-list {
        max-height: 300px;
    }
    
    .actions {
        gap: 8px;
    }
    
    .btn {
        padding: 8px 14px;
        font-size: 0.85rem;
    }
    
    .viewer-meta {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .email-text {
        font-size: 0.8rem;
    }
    
    .logo h1 {
        font-size: 1.2rem;
    }
}

/* ─── Scrollbar ──────────────────────────────────────────────── */

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ─── Animations ─────────────────────────────────────────────── */

.email-item {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateX(10px); }
    to { opacity: 1; transform: translateX(0); }
}
