/* CSS Variables & Theme Setup */
:root {
    --bg-main: #0a0b14;
    --card-bg: rgba(22, 24, 47, 0.4);
    --card-border: rgba(255, 255, 255, 0.05);
    --card-glow: rgba(124, 58, 237, 0.1);
    
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    
    --accent-purple: #7c3aed;
    --accent-purple-glow: rgba(124, 58, 237, 0.4);
    --accent-cyan: #06b6d4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.4);
    
    --success-green: #10b981;
    --danger-red: #ef4444;
    
    --font-ar: 'Tajawal', sans-serif;
    --font-en: 'Outfit', sans-serif;
}

/* Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-ar);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
    padding-bottom: 24px;
}

/* Background Glow Effects */
.bg-glow-1 {
    position: fixed;
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: radial-gradient(circle, rgba(124, 58, 237, 0.15) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

.bg-glow-2 {
    position: fixed;
    bottom: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.12) 0%, rgba(0,0,0,0) 70%);
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
}

/* App Container */
.app-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Header */
.app-header {
    background: rgba(15, 17, 36, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 16px 20px;
    margin-bottom: 4px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.2);
}

.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

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

.logo-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent-purple), var(--accent-cyan));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.logo-area h1 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.subtitle {
    font-family: var(--font-en);
    font-size: 0.75rem;
    color: var(--text-secondary);
    letter-spacing: 0.5px;
}

.status-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 6px 12px;
    border-radius: 30px;
    border: 1px solid rgba(255, 255, 255, 0.03);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-muted);
    transition: background-color 0.3s ease;
}

.status-dot.active {
    background-color: var(--success-green);
    box-shadow: 0 0 10px var(--success-green);
}

.status-dot.pulsing {
    background-color: var(--success-green);
    animation: pulse 1.5s infinite alternate;
}

.status-text {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Stats Container */
.stats-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    text-align: center;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: rgba(124, 58, 237, 0.2);
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stat-value {
    font-family: var(--font-en);
    font-size: 1.4rem;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, var(--text-secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.stat-value.text-green {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    color: var(--success-green);
}

.stat-value.text-amber {
    background: none;
    -webkit-background-clip: unset;
    -webkit-text-fill-color: unset;
    color: #f59e0b;
}

/* Search and Controls */
.controls-row {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-wrapper {
    position: relative;
    flex-grow: 1;
}

.search-icon {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    display: flex;
    align-items: center;
}

#search-input {
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    padding: 12px 42px 12px 14px;
    border-radius: 14px;
    color: var(--text-primary);
    font-family: var(--font-ar);
    font-size: 0.9rem;
    outline: none;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#search-input:focus {
    border-color: var(--accent-purple);
    box-shadow: 0 0 10px var(--card-glow);
}

/* Buttons */
.btn {
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    font-family: var(--font-ar);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.btn:active {
    transform: scale(0.95);
}

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

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    box-shadow: 0 4px 15px rgba(239, 68, 68, 0.15);
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent-purple), #6d28d9);
    color: white;
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.05rem;
    border-radius: 16px;
}

/* Messages List */
.messages-list-wrapper {
    min-height: 300px;
    display: flex;
    flex-direction: column;
}

.messages-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Message Card */
.message-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 18px;
    padding: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    animation: slideIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
    transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.message-card:hover {
    border-color: rgba(6, 182, 212, 0.2);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sender-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sender-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-cyan);
}

.sender-number {
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.5px;
    color: var(--text-primary);
}

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

.icon-btn {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

.icon-btn.btn-delete-single:hover {
    color: var(--danger-red);
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
}

/* Message Body */
.message-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
    word-break: break-word;
    white-space: pre-line;
}

/* OTP Block */
.otp-container {
    background: rgba(124, 58, 237, 0.07);
    border: 1px dashed rgba(124, 58, 237, 0.3);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 4px;
}

.otp-label-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.otp-badge {
    background: var(--accent-purple);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.otp-code {
    font-family: var(--font-en);
    font-weight: 800;
    font-size: 1.2rem;
    letter-spacing: 2px;
    color: #fff;
    text-shadow: 0 0 10px rgba(124, 58, 237, 0.5);
}

.btn-copy-otp {
    background: var(--accent-purple);
    color: white;
    font-family: var(--font-ar);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
    transition: all 0.2s ease;
}

.btn-copy-otp:hover {
    background: #6d28d9;
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.5);
}

.card-footer {
    display: flex;
    justify-content: flex-end;
    font-family: var(--font-en);
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    background: rgba(15, 17, 36, 0.4);
    border: 1px dashed var(--card-border);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.empty-icon {
    color: var(--text-muted);
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 250px;
    line-height: 1.5;
}

/* Permission Overlay */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 11, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.overlay-card {
    background: rgba(20, 22, 45, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    padding: 30px 20px;
    text-align: center;
    max-width: 400px;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
    transform: translateY(20px);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.overlay.visible .overlay-card {
    transform: translateY(0);
}

.permission-icon {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.1);
    color: var(--accent-purple);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(124, 58, 237, 0.15);
}

.overlay-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
}

.overlay-card p {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: rgba(16, 185, 129, 0.9);
    color: white;
    padding: 10px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.85rem;
    box-shadow: 0 10px 25px rgba(16, 185, 129, 0.3);
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    pointer-events: none;
}

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

/* Keyframes */
@keyframes pulse {
    0% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(16, 185, 129, 0);
    }
    100% {
        transform: scale(0.9);
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0);
    }
}

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

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: var(--bg-main);
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Download Banner */
.download-banner {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(6, 182, 212, 0.12));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px dashed rgba(124, 58, 237, 0.3);
    border-radius: 20px;
    padding: 16px;
    margin-bottom: 8px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.15);
    animation: slideIn 0.35s ease forwards;
}

.banner-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.banner-text {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: right;
}

.banner-text h3 {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
}

.banner-text p {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.btn-download {
    padding: 10px 20px;
    font-size: 0.85rem;
    border-radius: 10px;
    white-space: nowrap;
    text-decoration: none;
}

