/* Base Styles */
:root {
    --primary-color: #2a1145;
    --secondary-color: #120821;
    --text-color: #fff;
    --card-bg: rgba(255, 255, 255, 0.08);
    --card-border: rgba(255, 255, 255, 0.15);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', 'Tajawal', sans-serif;
}

body {
    background: linear-gradient(135deg, var(--primary-color), #000);
    color: var(--text-color);
    min-height: 100vh;
    overflow-x: hidden;
    transition: all 0.3s ease;
    position: relative;
}

body.rtl * {
    font-family: 'Tajawal', 'Poppins', sans-serif;
}

/* Ensure RTL layout consistency */
[dir="rtl"] .feature-grid,
[dir="rtl"] .team-grid {
    direction: rtl;
}

/* Fix nav alignment in RTL */
[dir="rtl"] .main-nav ul {
    direction: rtl;
    justify-content: center;
}

[dir="rtl"] .nav-links {
    justify-content: center;
}

[dir="rtl"] .nav-logo {
    left: auto;
    right: 0;
    padding-left: 0;
    padding-right: 1.5rem;
}

/* Fix animations for RTL */
[dir="rtl"] .glass-card::after {
    background: linear-gradient(235deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 60%);
}

/* Consistent paddings in both directions */
[dir="rtl"] .glass-card {
    text-align: center;
}

/* Fix icon alignments in RTL */
[dir="rtl"] h3 i {
    margin-left: 0.5rem;
    margin-right: 0;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
    z-index: 10;
}

/* Language Toggle */
.language-toggle {
    position: absolute;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    z-index: 1001;
}

[dir="rtl"] .language-toggle {
    right: auto;
    left: 1.5rem;
}

.language-toggle button {
    background: transparent;
    border: none;
    transition: all 0.3s ease;
    cursor: pointer;
    width: 40px;
    height: 40px;
    padding: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.flag-icon {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.language-toggle button:hover {
    transform: scale(1.1);
}

/* Background Animation and Graph Paper */
.background {
    position: fixed;
    width: 100vw;
    height: 100vh;
    top: 0;
    left: 0;
    z-index: 0;
    overflow: hidden;
}

/* Graph paper effect */
.background::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 20px 20px;
    background-position: center center;
    z-index: -1;
    opacity: 0.7;
}

.background::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.02) 2px, transparent 2px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 2px, transparent 2px);
    background-size: 100px 100px;
    background-position: center center;
    z-index: -2;
    opacity: 0.5;
}

.shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.02);
    animation: float 15s infinite ease-in-out;
}

.shape:nth-child(1) {
    width: 500px;
    height: 500px;
    top: -250px;
    right: -100px;
    animation-delay: 0s;
    background: radial-gradient(circle, rgba(90, 45, 140, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
}

.shape:nth-child(2) {
    width: 400px;
    height: 400px;
    bottom: -200px;
    left: -100px;
    animation-delay: -5s;
    background: radial-gradient(circle, rgba(90, 45, 140, 0.1) 0%, rgba(0, 0, 0, 0) 70%);
}

@keyframes float {
    0%, 100% {
        transform: translateY(0) rotate(0deg);
    }
    50% {
        transform: translateY(-30px) rotate(10deg);
    }
}

/* Glass Card Style */
.glass-card {
    background: var(--card-bg);
    border-radius: 15px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 1.8rem;
    margin-bottom: 3rem;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    max-width: 100%;
    position: relative;
    overflow: hidden;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.4);
}

.glass-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(125deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0) 60%);
    pointer-events: none;
}

/* Navigation Styles */
.main-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: rgba(25, 10, 41, 0.9);
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin: 0 auto;
    padding: 0.5rem 0;
    position: relative;
}

.nav-logo {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    padding-left: 1.5rem;
}

.nav-logo #unity-logo {
    font-size: 2.2rem;
    margin: 0;
    padding: 0;
    font-weight: 900;
    text-transform: uppercase;
    color: #fff;
    text-align: center;
    letter-spacing: 4px;
    direction: ltr !important;
    text-shadow: 2px 2px 0 rgba(137, 83, 241, 0.8);
}

.nav-links {
    width: 100%;
    display: flex;
    justify-content: center;
}

.main-nav ul {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    padding: 0;
    gap: 2rem;
    margin: 0;
}

.main-nav li {
    position: relative;
    text-align: center;
}

.main-nav a {
    color: #fff;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    padding: 0.7rem 1rem;
    transition: all 0.3s ease;
    display: block;
    letter-spacing: 0.5px;
}

.main-nav a:hover {
    color: var(--primary-color);
    background: rgba(255, 255, 255, 0.9);
}

.main-nav a:active {
    transform: translateY(1px);
}

/* Header Styles - spacer to account for fixed nav */
.page-header {
    padding-top: 5rem;
    margin-bottom: 2rem;
}

.logo {
    text-align: center;
    position: relative;
    margin-bottom: 20px;
}

/* Logo styling moved to inline style in HTML */

/* Hero Section */
.hero {
    text-align: center;
    margin-bottom: 5rem;
}

/* Reinforce center alignment for all sections in both languages */
.hero, .features, .team, footer, 
[dir="rtl"] .hero, [dir="rtl"] .features, [dir="rtl"] .team, [dir="rtl"] footer {
    text-align: center !important;
}

.hero h2 {
    font-size: 2.3rem;
    margin-bottom: 1.5rem;
}

.hero p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    opacity: 0.9;
}

.server-list {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-top: 2.5rem;
}

.server {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    text-decoration: none;
    color: var(--text-color);
}

.server:hover {
    transform: scale(1.05);
    background: rgba(255, 255, 255, 0.1);
}

.server i {
    font-size: 1.8rem;
}

.server span {
    font-weight: 500;
    font-size: 1.1rem;
}

/* Features Section */
.features {
    margin-bottom: 5rem;
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.8rem;
    margin-top: 2.5rem;
}

.feature {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.feature:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.07);
}

.feature i {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: rgba(255, 255, 255, 0.9);
}

.feature h4 {
    font-size: 1.2rem;
    margin-bottom: 0.8rem;
}

.feature p,
[dir="rtl"] .feature p {
    opacity: 0.8;
    font-size: 0.95rem;
    line-height: 1.6;
    flex-grow: 1;
    text-align: center !important;
}

/* Team Section */
.team-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2.5rem;
    margin-top: 2.5rem;
}

.team-member {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2rem 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    height: 100%;
}

.team-member:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.07);
}

.avatar {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, var(--secondary-color), var(--primary-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.2);
    overflow: hidden;
}

.avatar i {
    font-size: 2rem;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.team-member h4 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.team-member p {
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin-top: 1rem;
}

.social-link {
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 50%;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-link:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* Footer */
footer {
    margin-top: 5rem;
    text-align: center;
}

.footer-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2rem;
    padding: 2rem 1.5rem;
    opacity: 0.9;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 3rem;
    width: 100%;
}

.footer-section {
    min-width: 180px;
}

.footer-section h3 {
    font-size: 1.3rem;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-section ul {
    list-style: none;
    padding: 0;
    margin: 0;
    text-align: center;
}

.footer-section ul li {
    margin-bottom: 0.8rem;
}

.footer-section ul a {
    color: #fff;
    text-decoration: none;
    opacity: 0.8;
    transition: opacity 0.3s ease;
}

.footer-section ul a:hover {
    opacity: 1;
}

.footer-bottom {
    width: 100%;
    padding-top: 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Section Headings */
h3 {
    text-align: center;
    font-size: 1.8rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

h3 i {
    margin-right: 0.5rem;
}

body.rtl h3 i {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Language-specific elements */
[lang] {
    transition: opacity 0.3s ease;
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }
    
    .logo h1 {
        font-size: 2.5rem;
    }
    
    .hero h2 {
        font-size: 1.8rem;
    }
    
    .server-list {
        flex-direction: column;
        gap: 1rem;
    }
    
    .feature-grid, .team-grid {
        grid-template-columns: 1fr;
    }
}