/* ============================================
   MAWADA MISYAR - SHARED COMPONENTS
   المكونات المشتركة
   ============================================ */

/* ============================================
   1. PAGE TABS - التبويبات الفرعية
   ============================================ */
.page-tabs {
    display: flex;
    gap: 5px;
    background: var(--white);
    padding: 8px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.page-tabs .tab-item {
    flex: 1;
    padding: 12px 20px;
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.page-tabs .tab-item:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.page-tabs .tab-item.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    box-shadow: 0 4px 15px rgba(21, 101, 192, 0.3);
}

.page-tabs .tab-item i {
    font-size: 14px;
}

.page-tabs .tab-badge {
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    margin-right: 5px;
}

.page-tabs .tab-item.active .tab-badge {
    background: rgba(255, 255, 255, 0.3);
}

/* ============================================
   2. NEW SIDEBAR - القائمة الجانبية الجديدة
   ============================================ */
.app-sidebar {
    width: 280px;
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
    height: fit-content;
}

/* Sidebar scrollbar styling */
.app-sidebar::-webkit-scrollbar {
    width: 4px;
}

.app-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.app-sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

.app-sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Skeleton Loading */
.skeleton-avatar {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    margin: 0 auto;
}

.skeleton-text {
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.3) 50%, rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* User Profile Section */
.sidebar-profile {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    padding: 25px 20px;
    text-align: center;
    position: relative;
}

.sidebar-profile::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    right: 0;
    height: 25px;
    background: var(--white);
    border-radius: 50% 50% 0 0 / 100% 100% 0 0;
}

.sidebar-avatar-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 12px;
}

.sidebar-avatar {
    width: 85px;
    height: 85px;
    border-radius: 50%;
    border: 4px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.sidebar-status {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 18px;
    height: 18px;
    background: var(--success);
    border: 3px solid var(--white);
    border-radius: 50%;
}

.sidebar-username {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 5px;
}

.sidebar-membership {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 4px 12px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: 600;
}

.sidebar-membership i {
    color: var(--gold);
}

/* Sidebar Navigation */
.sidebar-nav {
    padding: 15px 0;
}

.sidebar-nav-section {
    padding: 0 15px;
    margin-bottom: 10px;
}

.sidebar-nav-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    padding: 10px 15px 5px;
    letter-spacing: 0.5px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
    border-right: 3px solid transparent;
    position: relative;
}

.sidebar-link:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-right-color: var(--primary);
}

.sidebar-link.active {
    background: var(--primary-light);
    color: var(--primary);
    border-right-color: var(--accent);
    font-weight: 600;
}

.sidebar-link i {
    width: 20px;
    font-size: 16px;
    text-align: center;
    color: var(--text-muted);
    transition: color 0.3s;
}

.sidebar-link:hover i,
.sidebar-link.active i {
    color: var(--primary);
}

.sidebar-link .badge {
    margin-right: auto;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sidebar-link .badge.blue {
    background: var(--primary);
}

.sidebar-link .badge.green {
    background: var(--success);
}

.sidebar-link .badge.gold {
    background: var(--gold);
    color: #5d4037;
}

/* Sidebar Submenu */
.sidebar-submenu {
    background: #f8f9fa;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.sidebar-link.has-submenu.open + .sidebar-submenu {
    max-height: 200px;
}

.sidebar-submenu .sub-link {
    display: block;
    padding: 10px 20px 10px 52px;
    font-size: 13px;
    color: var(--text-muted);
    transition: all 0.3s;
}

.sidebar-submenu .sub-link:hover,
.sidebar-submenu .sub-link.active {
    color: var(--primary);
    background: var(--primary-light);
}

.sidebar-submenu .sub-link::before {
    content: '•';
    margin-left: 8px;
    color: var(--text-muted);
}

/* Sidebar Divider */
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 20px;
}

/* Sidebar Logout */
.sidebar-logout {
    padding: 15px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-logout .sidebar-link {
    color: #e53935;
    border-radius: 8px;
}

.sidebar-logout .sidebar-link:hover {
    background: #ffebee;
    border-right-color: #e53935;
}

.sidebar-logout .sidebar-link i {
    color: #e53935;
}

/* ============================================
   3. HEADER ICONS - أيقونات الشريط العلوي
   ============================================ */
.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-icon-btn {
    position: relative;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-icon-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

.header-icon-btn .notif-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid var(--primary);
    animation: pulse-badge 2s infinite;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Notifications Dropdown */
.notif-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 350px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 1000;
    margin-top: 10px;
}

.header-icon-btn:hover .notif-dropdown,
.notif-dropdown:hover {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.notif-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
}

.notif-header h4 {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.notif-header a {
    font-size: 12px;
    color: var(--primary);
}

.notif-list {
    max-height: 300px;
    overflow-y: auto;
}

.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
}

.notif-item:hover {
    background: var(--primary-light);
}

.notif-item.unread {
    background: #e3f2fd;
}

.notif-item .notif-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.notif-item .notif-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.notif-icon.like { background: #fce4ec; color: var(--accent); }
.notif-icon.visit { background: #e3f2fd; color: var(--primary); }
.notif-icon.message { background: #e8f5e9; color: var(--success); }

.notif-content {
    flex: 1;
}

.notif-content p {
    font-size: 13px;
    color: var(--text);
    margin-bottom: 3px;
}

.notif-content span {
    font-size: 11px;
    color: var(--text-muted);
}

.notif-footer {
    padding: 12px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.notif-footer a {
    font-size: 13px;
    font-weight: 600;
    color: var(--primary);
}

/* User Menu Dropdown */
.user-menu-wrapper {
    position: relative;
}

.user-menu-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 25px;
    padding: 5px 15px 5px 5px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s;
}

.user-menu-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.user-menu-btn img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.5);
}

.user-menu-btn span {
    font-size: 13px;
    font-weight: 600;
}

.user-menu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 200px;
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s;
    z-index: 1000;
    margin-top: 10px;
    overflow: hidden;
}

.user-menu-wrapper:hover .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-dropdown a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    font-size: 13px;
    color: var(--text);
    transition: all 0.3s;
}

.user-menu-dropdown a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.user-menu-dropdown a i {
    width: 18px;
    color: var(--text-muted);
}

.user-menu-dropdown a:hover i {
    color: var(--primary);
}

.user-menu-dropdown .divider {
    height: 1px;
    background: var(--border);
    margin: 5px 0;
}

.user-menu-dropdown a.logout {
    color: #e53935;
}

.user-menu-dropdown a.logout i {
    color: #e53935;
}

/* ============================================
   4. PAGE HEADER - عنوان الصفحة
   ============================================ */
.page-header {
    background: var(--white);
    padding: 25px 30px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header-info h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header-info h1 i {
    color: var(--primary);
}

.page-header-info p {
    font-size: 13px;
    color: var(--text-muted);
}

.page-header-actions {
    display: flex;
    gap: 10px;
}

/* ============================================
   5. STATS CARDS - كروت الإحصائيات
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--white);
    padding: 25px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    color: var(--primary);
}

.stat-icon.pink {
    background: linear-gradient(135deg, #fce4ec, #f8bbd9);
    color: var(--accent);
}

.stat-icon.green {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    color: var(--success);
}

.stat-icon.gold {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    color: #ff8f00;
}

.stat-info h3 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 3px;
}

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
}

/* ============================================
   6. CONTENT CARD - كارت المحتوى
   ============================================ */
.content-card {
    background: var(--white);
    border-radius: 16px;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.content-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    border-bottom: 1px solid var(--border);
}

.content-card-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.content-card-header h3 i {
    color: var(--primary);
}

.content-card-body {
    padding: 25px;
}

.content-card-footer {
    padding: 15px 25px;
    border-top: 1px solid var(--border);
    text-align: center;
}

/* ============================================
   7. FILTERS BAR - شريط الفلاتر
   ============================================ */
.filters-bar {
    background: var(--white);
    padding: 15px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-group select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    background: #fff;
    min-width: 120px;
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary);
}

.btn-filter {
    background: var(--primary);
    color: #fff;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.3s;
    margin-right: auto;
}

.btn-filter:hover {
    background: var(--primary-dark);
}

/* ============================================
   8. EMPTY STATE - حالة فارغة
   ============================================ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
}

.empty-state-icon {
    width: 100px;
    height: 100px;
    background: var(--primary-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 40px;
    color: var(--primary);
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}

.empty-state p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}

/* ============================================
   9. MESSAGES LIST - قائمة الرسائل
   ============================================ */
.messages-list {
    list-style: none;
}

.message-item {
    display: flex;
    gap: 15px;
    padding: 15px 20px;
    border-bottom: 1px solid var(--border);
    transition: background 0.3s;
    cursor: pointer;
}

.message-item:hover {
    background: var(--primary-light);
}

.message-item.unread {
    background: #e3f2fd;
}

.message-item.unread .message-preview {
    font-weight: 600;
    color: var(--text);
}

.message-avatar {
    position: relative;
    flex-shrink: 0;
}

.message-avatar img {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.message-avatar .online-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background: var(--success);
    border: 2px solid var(--white);
    border-radius: 50%;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.message-sender {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
}

.message-time {
    font-size: 11px;
    color: var(--text-muted);
}

.message-preview {
    font-size: 13px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-item.unread::after {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--accent);
    border-radius: 50%;
    align-self: center;
}

/* ============================================
   10. RESPONSIVE - التجاوب
   ============================================ */
@media (max-width: 1024px) {
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .page-tabs {
        flex-wrap: wrap;
    }
    
    .page-tabs .tab-item {
        flex: 1 1 calc(33.333% - 5px);
        padding: 10px 15px;
        font-size: 12px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .page-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .filters-bar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        justify-content: space-between;
    }
    
    .btn-filter {
        margin-right: 0;
        justify-content: center;
    }
    
    .app-sidebar {
        position: fixed;
        top: 0;
        right: -300px;
        height: 100vh;
        z-index: 1001;
        border-radius: 0;
        transition: right 0.3s ease;
    }
    
    .app-sidebar.active {
        right: 0;
    }
    
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }
    
    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }
    
    .notif-dropdown {
        width: 300px;
        right: -50px;
        left: auto;
    }
}

@media (max-width: 480px) {
    .page-tabs .tab-item {
        flex: 1 1 100%;
    }
    
    .page-tabs .tab-item span {
        display: none;
    }
    
    .page-tabs .tab-item i {
        font-size: 18px;
    }
}
