/* الهواتف الصغيرة */
@media (max-width: 576px) {
    .header-container {
        flex-wrap: wrap;
    }
    
    .logo {
        margin-bottom: 0.5rem;
    }
    
    .search-box {
        width: 100%;
        order: 3;
        margin-top: 0.5rem;
    }
    
    .main-nav {
        display: none;
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .main-nav.mobile-open {
        display: block;
    }
    
    .main-nav ul {
        flex-direction: column;
    }
    
    .main-nav ul li {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        margin-left: 0;
        margin-bottom: 1rem;
        height: auto;
        max-height: 300px;
    }
    
    .export-buttons {
        flex-direction: column;
    }
    
    .ayah-actions {
        flex-wrap: wrap;
    }
    
    .reading-header {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
    }
    
    .reading-controls {
        justify-content: center;
    }
    
    .tafseer-popup {
        width: 95%;
        max-width: none;
        padding: 1rem;
    }
    
    .popup-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .footer-section {
        width: 100%;
        flex: none;
    }
    
    .topic-meta {
        flex-direction: column;
        align-items: center;
    }
    
    .topic-view {
        padding: 1rem;
    }
    
    .topics-grid {
        grid-template-columns: 1fr;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-avatar {
        margin-left: 0;
        margin-bottom: 1rem;
    }
    
    .user-topic-item,
    .bookmark-item {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .topic-actions,
    .bookmark-actions {
        width: 100%;
        justify-content: center;
    }
}

/* الهواتف المتوسطة والأجهزة اللوحية الصغيرة */
@media (min-width: 577px) and (max-width: 768px) {
    .main-container {
        flex-direction: column;
    }
    
    .sidebar {
        width: 100%;
        margin-left: 0;
        margin-bottom: 1rem;
        height: auto;
        max-height: 300px;
    }
    
    .main-nav {
        display: none;
    }
    
    .main-nav.mobile-open {
        display: block;
        position: absolute;
        top: 100%;
        right: 0;
        background-color: var(--primary-color);
        width: 200px;
        padding: 1rem;
        border-bottom-left-radius: var(--border-radius);
        box-shadow: var(--box-shadow);
    }
    
    .main-nav ul {
        flex-direction: column;
    }
    
    .main-nav ul li {
        margin-right: 0;
        margin-bottom: 0.5rem;
    }
    
    .menu-toggle {
        display: block;
    }
    
    .footer-container {
        flex-wrap: wrap;
    }
    
    .footer-section {
        width: 50%;
        flex: none;
    }
    
    .topics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .user-topic-item,
    .bookmark-item {
        flex-wrap: wrap;
    }
    
    .topic-details,
    .bookmark-details {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* الأجهزة اللوحية والشاشات المتوسطة */
@media (min-width: 769px) and (max-width: 992px) {
    .sidebar {
        width: 220px;
    }
    
    .topics-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* الشاشات الكبيرة */
@media (min-width: 993px) {
    .main-container {
        padding: 0 2rem;
    }
    
    .content-area {
        min-height: calc(100vh - 160px);
    }
}
