:root {
    --primary-orange: #FF6B00;
    --bg-dark: #121212; --card-dark: #1E1E1E; --text-dark: #E0E0E0;
    --bg-light: #F4F4F4; --card-light: #FFFFFF; --text-light: #1A1A1A;
}

body { margin: 0; font-family: 'Segoe UI', Tahoma, sans-serif; transition: 0.3s; min-height: 100vh; }
body.dark-mode { background-color: var(--bg-dark); color: var(--text-dark); }
body.light-mode { background-color: var(--bg-light); color: var(--text-light); }

.main-wrapper { padding: 40px 20px; display: flex; flex-direction: column; align-items: center; }

/* التحكم */
.mode-lang-ctrl { width: 100%; max-width: 1200px; display: flex; justify-content: space-between; margin-bottom: 30px; }
.mini-btn { background: rgba(128,128,128,0.2); border: 1px solid #555; color: inherit; padding: 8px 15px; border-radius: 5px; cursor: pointer; font-size: 13px; }

/* الهيدر */
.header-section { text-align: center; max-width: 800px; margin-bottom: 50px; }
.logo-box img { max-width: 200px; margin-bottom: 20px; }
h1 { font-size: 2rem; color: var(--primary-orange); margin-bottom: 15px; }
p { font-size: 1.1rem; line-height: 1.6; opacity: 0.9; }

/* شبكة الأدوات الذكية */
.apps-grid { 
    display: flex; 
    flex-wrap: wrap; 
    gap: 20px; 
    justify-content: center; /* هذا السطر يضمن التوسيط التلقائي */
    max-width: 1200px; 
    width: 100%;
}

.app-card {
    text-decoration: none;
    color: inherit;
    width: 160px;
    height: 160px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-radius: 20px;
    transition: 0.3s;
    text-align: center;
}

body.dark-mode .app-card { background: var(--card-dark); box-shadow: 0 4px 15px rgba(0,0,0,0.3); }
body.light-mode .app-card { background: var(--card-light); box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

.app-card:hover { transform: translateY(-10px); border: 2px solid var(--primary-orange); }

.app-icon { width: 60px; height: 60px; margin-bottom: 15px; color: var(--primary-orange); }
.app-name { font-weight: bold; font-size: 1rem; }

/* Responsive استجابة الشاشات */
/* اللابتوب: 6 في الصف (أصلاً مدعومة بالتوسيط) */
@media (min-width: 1024px) {
    .apps-grid { max-width: 1100px; }
}

/* الجوال والتابلت: 3 في الصف */
@media (max-width: 1023px) {
    .app-card { width: calc(33.33% - 20px); min-width: 100px; height: 140px; }
}

/* الجوال الصغير جداً: 2 في الصف */
@media (max-width: 480px) {
    .app-card { width: calc(50% - 20px); }
}

.main-footer {
    margin-top: auto; /* يدفعه للأسفل إذا كانت الصفحة فارغة */
    padding: 40px 0 20px 0;
    text-align: center;
}

.main-footer a {
    text-decoration: none;
    font-size: 0.9rem;
    color: inherit;
    opacity: 0.7;
    transition: 0.3s;
}

.main-footer a:hover {
    opacity: 1;
    color: var(--primary-orange);
}

/* لجعل المجمع الرئيسي مرن ويدفع الفوتر للأسفل */
.main-wrapper {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
}