:root {
    --el-base: #0e0520;
    --el-base-hover: #1c0a3d;
    --el-base-active: #2a0f5c;
    --el-base-border: rgba(198, 169, 254, 0.28);
    --el-base-subtle: #c6a9fe;
    --el-base-primary: #ffffff;
    --el-accent: #ccff00;
    --el-accent-hover: #b8e600;
    --el-accent-primary: #080214;
}

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

body {
    background-color: var(--el-base);
    color: var(--el-base-primary);
    font-family: 'Tajawal', sans-serif;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    padding: 1.5rem 1rem;
    /* Tech grid background */
    background-image: 
        linear-gradient(rgba(198, 169, 254, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(198, 169, 254, 0.04) 1px, transparent 1px);
    background-size: 32px 32px;
}

/* Language Switcher */
.lang-switch-container {
    position: fixed;
    top: 1.5rem;
    z-index: 100;
    transition: all 0.3s ease;
}

html[dir="rtl"] .lang-switch-container {
    left: 1.5rem;
    right: auto;
}

html[dir="ltr"] .lang-switch-container {
    right: 1.5rem;
    left: auto;
}

#lang-switch-btn {
    background: rgba(14, 5, 32, 0.75);
    border: 1px solid var(--el-base-border);
    color: var(--el-base-primary);
    padding: 0.55rem 1.4rem;
    border-radius: 24px;
    font-family: inherit;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

#lang-switch-btn:hover {
    background: rgba(204, 255, 0, 0.12);
    border-color: var(--el-accent);
    color: var(--el-accent);
    box-shadow: 0 0 20px rgba(204, 255, 0, 0.25);
    transform: translateY(-2px);
}

/* Background Glow Elements */
.glow-effect {
    position: fixed;
    border-radius: 50%;
    filter: blur(80px);
    z-index: 0;
    opacity: 0.4;
    pointer-events: none;
    will-change: transform;
    contain: strict;
}

.purple-glow {
    width: min(650px, 90vw);
    height: min(650px, 90vw);
    background: radial-gradient(circle, rgba(122, 0, 255, 0.45) 0%, rgba(122, 0, 255, 0) 70%);
    top: -100px;
    right: -100px;
}

.lime-glow {
    width: min(550px, 80vw);
    height: min(550px, 80vw);
    background: radial-gradient(circle, rgba(200, 254, 52, 0.35) 0%, rgba(200, 254, 52, 0) 70%);
    bottom: -100px;
    left: -100px;
}

/* Main Layout Wrapper */
.main-layout {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 580px;
    margin: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Main Card */
.agent-container {
    background: rgba(14, 5, 32, 0.75);
    border: 1px solid var(--el-base-border);
    border-radius: 28px;
    padding: 2.75rem 2rem 2.25rem;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.85), 0 0 40px rgba(72, 0, 165, 0.3);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    position: relative;
    overflow: visible; /* Prevent clipping of expanded widget dialogs */
    transition: all 0.3s ease;
}

/* Avatar Section */
.avatar-wrapper {
    position: relative;
    width: 210px;
    height: 210px;
    margin-bottom: 1.5rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.avatar-image {
    width: 190px;
    height: 190px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--el-accent);
    box-shadow: 0 0 35px rgba(204, 255, 0, 0.35), 0 0 15px rgba(122, 0, 255, 0.5);
    z-index: 2;
    position: relative;
    transition: transform 0.3s ease;
    will-change: transform;
}

.avatar-wrapper:hover .avatar-image {
    transform: scale(1.02);
}

.avatar-ring {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px dashed rgba(198, 169, 254, 0.6);
    animation: rotateRing 25s linear infinite;
    z-index: 1;
    will-change: transform;
}

@keyframes rotateRing {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Agent Information */
.agent-info {
    text-align: center;
    margin-bottom: 1.5rem;
    z-index: 2;
    width: 100%;
}

.agent-info h1 {
    font-size: 2.3rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #ffffff 40%, var(--el-accent) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.agent-info p {
    color: var(--el-base-subtle);
    font-size: 1.1rem;
    font-weight: 500;
    line-height: 1.5;
}

/* Widget Anchor Container */
.widget-anchor {
    position: relative;
    width: 100%;
    min-height: 125px;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10;
}

/* Responsive Styles for Tablet & Mobile */
@media (max-width: 640px) {
    body {
        padding: 1rem 0.75rem;
        align-items: flex-start;
    }

    .lang-switch-container {
        top: 1rem;
    }

    html[dir="rtl"] .lang-switch-container {
        left: 1rem;
    }

    html[dir="ltr"] .lang-switch-container {
        right: 1rem;
    }

    #lang-switch-btn {
        padding: 0.45rem 1.1rem;
        font-size: 0.85rem;
    }

    .main-layout {
        max-width: 100%;
        margin-top: 2.75rem;
    }

    .agent-container {
        padding: 2rem 1.25rem 1.75rem;
        border-radius: 22px;
    }

    .avatar-wrapper {
        width: 160px;
        height: 160px;
        margin-bottom: 1.25rem;
    }

    .avatar-image {
        width: 145px;
        height: 145px;
    }

    .agent-info h1 {
        font-size: 1.85rem;
    }

    .agent-info p {
        font-size: 0.95rem;
    }

    .widget-anchor {
        min-height: 110px;
    }
}
