:root {
    --primary-color: #e04c4c;
    --primary-hover: #c0392b;
    --secondary-color: #1e3a8a;
    --bg-gradient-start: #f8fafc;
    --bg-gradient-end: #e2e8f0;
    --text-main: #0f172a;
    --text-muted: #475569;
    --card-bg: rgba(255, 255, 255, 0.9);
    --card-border: rgba(255, 255, 255, 0.6);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    --radius-lg: 1.5rem;
    --radius-md: 0.75rem;
}

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

body {
    font-family: 'Tajawal', sans-serif;
    background: linear-gradient(135deg, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
}

/* LTR Font Override */
html[dir="ltr"] body {
    font-family: 'Inter', sans-serif;
}

/* Background Shapes */
.background-shapes .shape {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    z-index: -1;
    opacity: 0.5;
}

.shape-1 {
    top: -10%;
    right: -5%;
    width: 500px;
    height: 500px;
    background: rgba(224, 76, 76, 0.15);
    animation: float 10s infinite ease-in-out;
}

.shape-2 {
    bottom: -10%;
    left: -5%;
    width: 400px;
    height: 400px;
    background: rgba(30, 58, 138, 0.15);
    animation: float 12s infinite ease-in-out reverse;
}

@keyframes float {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(20px, -20px);
    }
}

.container {
    width: 100%;
    max-width: 800px;
    padding: 2rem;
    z-index: 1;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
    animation: fadeInDown 0.8s ease-out;
    position: relative;
}

.header-top {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: flex-end;
    z-index: 10;
}

html[dir="ltr"] .header-top {
    justify-content: flex-end;
}

/* Language Dropdown */
.lang-dropdown {
    position: relative;
}

.lang-btn {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: var(--text-main);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

.lang-btn:hover {
    background: white;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.globe-icon {
    color: var(--secondary-color);
}

.chevron-icon {
    opacity: 0.5;
    transition: transform 0.2s;
}

.lang-dropdown.open .chevron-icon {
    transform: rotate(180deg);
}

.lang-menu {
    position: absolute;
    top: 120%;
    left: 0;
    /* Align left for RTL */
    background: white;
    border-radius: var(--radius-md);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    min-width: 140px;
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

html[dir="ltr"] .lang-menu {
    left: auto;
    right: 0;
    /* Align right for LTR */
}

.lang-dropdown.open .lang-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-item {
    display: flex;
    align-items: center;
    padding: 0.6rem 1rem;
    color: var(--text-main);
    text-decoration: none;
    border-radius: 0.5rem;
    transition: background 0.2s;
    font-weight: 500;
    font-size: 0.95rem;
}

.lang-item:hover {
    background: #f1f5f9;
    color: var(--primary-color);
}

.lang-item.active {
    background: #eff6ff;
    color: var(--secondary-color);
    font-weight: 700;
}

.logo-container h1 {
    font-size: 3rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.2rem;
    letter-spacing: -1px;
}

.subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Content Card */
.content-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 2.5rem;
    animation: fadeInUp 0.8s ease-out 0.2s backwards;
    display: flex;
    flex-direction: column;
    max-height: 75vh;
}

.card-header {
    margin-bottom: 1.5rem;
    text-align: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    padding-bottom: 1rem;
}

.card-header h2 {
    font-size: 1.8rem;
    margin-bottom: 0.5rem;
}

.last-updated {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.scrollable-content {
    flex-grow: 1;
    overflow-y: auto;
    padding-left: 1rem;
    margin-bottom: 1.5rem;
    padding-right: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--secondary-color) transparent;
}

/* Custom Scrollbar */
.scrollable-content::-webkit-scrollbar {
    width: 6px;
}

.scrollable-content::-webkit-scrollbar-track {
    background: transparent;
}

.scrollable-content::-webkit-scrollbar-thumb {
    background-color: #cbd5e1;
    border-radius: 20px;
}

.term-section {
    margin-bottom: 2rem;
}

.term-section h3 {
    font-size: 1.2rem;
    color: var(--primary-color);
    margin-bottom: 0.8rem;
}

.term-section h4 {
    font-size: 1.05rem;
    color: var(--text-main);
    margin-bottom: 0.5rem;
    font-weight: 700;
}

.term-section p {
    line-height: 1.7;
    color: var(--text-main);
    margin-bottom: 0.8rem;
    text-align: justify;
}

.term-section ul {
    list-style-position: inside;
    margin-bottom: 1rem;
    padding-inline-start: 1rem;
}

.term-section li {
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.footer {
    text-align: center;
    margin-top: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    animation: fadeIn 1s ease-out 0.5s backwards;
}

/* Animations */
@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 1rem;
    }

    .content-card {
        padding: 1.5rem;
        max-height: 80vh;
    }

    .logo-container h1 {
        font-size: 2.2rem;
    }
}