/* ===================================================================
    المرحلة الأولى: الأساسيات والمتغيرات والجسم العام
=================================================================== */

:root {
    --primary: #4e54c8;
    --secondary: #8f94fb;
    --primary-brand-dark: #1A2980;
    --secondary-brand-light: #26D0CE;
    --gold: #ffc107;
    --red: #dc3545;
    --red-dark: #c82333;
    --green: #28a745;
    --white: #fff;
    --light: #f5f7fa;
    --dark: #333;
    --text-secondary: #6c757d;
}

* {
    box-sizing: border-box;
    font-family: 'Cairo', sans-serif;
}

body {
    background-color: var(--light);
    color: var(--dark);
    margin: 0;
    padding-bottom: 80px;
    /* مساحة للشريط السفلي */
    position: relative;
    z-index: 1;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: url('../images/logo.png');
    background-repeat: no-repeat;
    background-position: center center;
    background-size: contain;
    opacity: 0.03;
    z-index: -1;
}


/* === التنسيقات العامة والمشتركة === */

.page-content {
    padding: 0 20px;
    margin: -50px auto 0 auto;
    max-width: 900px;
    position: relative;
    z-index: 2;
}

.card {
    background: var(--white);
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.card h3,
.card h4 {
    margin-top: 0;
    margin-bottom: 15px;
}

/* ===================================================================
    ✨ تعديلات الهيدر النهائية (تدعم كل الصفحات) ✨
=================================================================== */

/* البانر العلوي */
.top-banner {
    background: linear-gradient(to bottom, var(--primary-brand-dark), var(--secondary-brand-light));
    color: white;
    padding: 25px 20px 70px 20px;
    border-bottom-left-radius: 35px;
    border-bottom-right-radius: 35px;
}

.top-banner .container {
    display: flex;
    flex-direction: column;
}

/* --- 1. تنسيق لوحة التحكم الرئيسية (my_courses.php) --- */
.header-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.header-logo-container .welcome-logo {
    height: 45px;
    width: auto;
    filter: brightness(0) invert(1);
    display: block;
}

.header-user-area {
    display: flex;
    align-items: center;
    gap: 20px;
}

/* --- 2. تنسيق الصفحات الأخرى (activity.php, profile.php) --- */
.welcome-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    margin-bottom: 20px;
}

.welcome-logo-container {
    flex-shrink: 0;
}

.welcome-logo {
    height: 45px;
    width: auto;
    filter: brightness(0) invert(1);
}

.welcome-text {
    font-size: 24px;
    font-weight: bold;
    margin: 0;
    color: white;
}

/* ===================================================================
    المرحلة الثانية: المكونات الأساسية - الأزرار والنماذج
=================================================================== */

.btn {
    display: inline-block;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    text-decoration: none;
    font-size: 1em;
    border: none;
    cursor: pointer;
    font-weight: 600;
    text-align: center;
    transition: all 0.3s;
}

.btn-full {
    width: 100%;
}

.btn i {
    margin-left: 8px;
}

.btn:not(.btn-danger):not(.btn-warning):not(.btn-secondary):not(.btn-random):not(.btn-review):not(.btn-logout) {
    background: linear-gradient(135deg, var(--primary-brand-dark), var(--secondary-brand-light));
}

.btn.btn-danger {
    background-color: var(--red);
}

.btn.btn-danger:hover {
    background-color: var(--red-dark);
}

.btn.btn-warning {
    background-color: var(--gold);
    color: var(--dark);
}

.btn.btn-random {
    background-color: #f39c12;
    color: white;
}

.btn.btn-review {
    background-color: #e74c3c;
    color: white;
}

.btn.btn-secondary {
    background-color: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.4);
}

.btn.btn-secondary:hover {
    background-color: rgba(255, 255, 255, 0.3);
}

.form-control {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 1.1em;
    text-align: center;
}

.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 8px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
}

/* ===================================================================
    المرحلة الثالثة: تنسيقات الصفحات الرئيسية
=================================================================== */

.status-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    color: white;
}

.status-box {
    background: rgba(255, 255, 255, 0.2);
    padding: 15px;
    border-radius: 12px;
    text-align: center;
}

.status-box i {
    font-size: 18px;
    display: block;
    margin-bottom: 5px;
}

.status-box span {
    font-size: 12px;
    font-weight: 600;
}

.subscription-status i {
    color: var(--gold) !important;
}

.daily-streak i {
    color: var(--red) !important;
}

.level-status i {
    color: var(--gold) !important;
}

.progress-container {
    background-color: #e0e0e0;
    border-radius: 20px;
    overflow: hidden;
    height: 18px;
    margin: 15px 0;
}

.progress-bar {
    background: var(--green);
    height: 100%;
    border-radius: 20px;
    color: white;
    font-size: 12px;
    font-weight: bold;
    text-align: center;
    line-height: 18px;
    transition: width 0.5s ease;
}

.other-courses-section {
    margin-top: 25px;
}

.other-courses-section h4 {
    font-size: 1.1em;
    font-weight: 700;
    margin-bottom: 15px;
}

.other-courses-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.other-course-card {
    background-color: #fff;
    padding: 20px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border: 1px solid #eee;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.other-course-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.browse-all-card {
    background: linear-gradient(135deg, var(--primary-brand-dark), var(--secondary-brand-light));
    border: none;
    color: var(--white);
}

.browse-all-card i {
    font-size: 1.2em;
}

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--white);
    display: flex;
    justify-content: space-around;
    border-top: 1px solid #eee;
    padding: 10px 0;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
    z-index: 1000;
}

.bottom-nav a {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    text-decoration: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.bottom-nav a.active {
    color: var(--primary-brand-dark);
    background-color: #eef2ff;
}

.bottom-nav i {
    font-size: 20px;
}

.activity-list-container {
    display: grid;
    gap: 10px;
}

.activity-item-link {
    text-decoration: none;
    color: inherit;
}

.activity-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--white);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
}

.activity-item:hover {
    transform: scale(1.02);
}

.activity-item-icon {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--white);
    flex-shrink: 0;
}

.activity-item-icon.score-success {
    background-color: var(--green);
}

.activity-item-icon.score-fail {
    background-color: var(--red);
}

.activity-item-details {
    flex-grow: 1;
}

.activity-item-details strong {
    font-size: 14px;
    display: block;
}

.activity-item-details small {
    font-size: 12px;
    color: #777;
}

.activity-item .fa-chevron-left {
    color: #ccc;
}

/* ===================================================================
    المرحلة الرابعة: تنسيقات الجرس والملف الشخصي
=================================================================== */

.notifications-bell {
    position: relative;
    cursor: pointer;
}

.notifications-bell .fa-bell {
    font-size: 24px;
    color: #fff;
    transition: transform 0.2s;
}

.notifications-bell:hover .fa-bell {
    transform: rotate(15deg);
}

.notification-count {
    position: absolute;
    top: -5px;
    right: -10px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid #4a5de1;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}

.notifications-dropdown {
    display: none;
    position: absolute;
    top: 45px;
    left: 0;
    width: 320px;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    overflow: hidden;
    text-align: right;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
}

.notifications-bell:hover .notifications-dropdown,
.notifications-bell.show-dropdown .notifications-dropdown {
    display: block;
    opacity: 1;
    visibility: visible;
}

.dropdown-header {
    padding: 12px 15px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.dropdown-header h3 {
    margin: 0;
    font-size: 16px;
    color: #333;
}

.dropdown-body {
    max-height: 300px;
    overflow-y: auto;
}

.notification-item,
.notification-item-static {
    display: block;
    padding: 12px 15px;
    border-bottom: 1px solid #e9ecef;
    color: #555;
    text-decoration: none;
    transition: background-color 0.2s;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background-color: #f1f3f5;
}

.notification-item.unread {
    background-color: #e9f5ff;
}

.notification-item.unread:hover {
    background-color: #dbeffd;
}

.notification-item p {
    margin: 0 0 5px 0;
    font-size: 14px;
    line-height: 1.4;
    font-weight: normal;
}

.notification-item.unread p {
    font-weight: bold;
    color: #222;
}

.notification-item small {
    font-size: 12px;
    color: #888;
}

.dropdown-footer {
    padding: 10px;
    text-align: center;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.dropdown-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: bold;
    font-size: 14px;
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 20px;
}

.profile-avatar-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--primary-brand-dark);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    flex-shrink: 0;
}

.profile-info h2 {
    margin: 0 0 5px 0;
}

.profile-info p {
    margin: 0;
    color: var(--text-secondary);
    font-size: 1.1em;
}

.profile-section {
    margin-top: 35px;
}

.profile-section h3 {
    font-size: 1.3em;
    margin-bottom: 10px;
}

.referral-code-box {
    display: flex;
    margin-top: 15px;
}

.referral-code-box input {
    flex-grow: 1;
    border: 2px solid var(--primary-brand-dark);
    border-left: none;
    background: #f5f7fa;
    color: var(--primary-brand-dark);
    font-weight: bold;
    border-radius: 0 8px 8px 0;
    text-align: center;
    font-size: 1.3em;
}

.referral-code-box .btn.copy-btn {
    border-radius: 8px 0 0 8px;
    background: var(--primary-brand-dark);
}

/* ===================================================================
    ✨ تنسيقات جديدة ومحسّنة لصفحة الملف الشخصي ✨
=================================================================== */

/* 1. يجعل النص والزر بجانب بعضهما على الشاشات الكبيرة */
.profile-action-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    /* مسافة بين النص والزر */
}

.profile-action-card p {
    margin: 0;
    flex-grow: 1;
    /* يسمح للنص بأخذ المساحة المتاحة */
    line-height: 1.6;
}

.profile-action-card .btn {
    flex-shrink: 0;
    /* يمنع الزر من التقلص */
}


/* 2. ألوان جديدة ومعبرة للأزرار */
.btn-friends {
    background-color: #3498db;
    /* أزرق سماوي */
}

.btn-friends:hover {
    background-color: #2980b9;
}

.btn-activate {
    background-color: #2ecc71;
    /* أخضر زاهي */
}

.btn-activate:hover {
    background-color: #27ae60;
}

.btn-security {
    background-color: #95a5a6;
    /* رمادي محايد */
    color: white;
}

.btn-security:hover {
    background-color: #7f8c8d;
}


/* 3. يضمن أن التصميم يبدو رائعًا على الجوال (النص فوق الزر) */
@media (max-width: 600px) {
    .profile-action-card {
        flex-direction: column;
        align-items: stretch;
        /* يجعل العناصر تمتد بعرض البطاقة */
        text-align: center;
    }
}

/* ===================================================================
   Motqen Chat UI styles are now centralized in templates/motqen_ui.php
   =================================================================== */