/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

/* Tablets and below */
@media (max-width: 1024px) {
    .ecosystem-section { padding: 0 20px; }
    .node-icon { width: 22px; height: 22px; margin-bottom: 4px; }
    .diagram-container { height: 500px; }
    .center-node { width: 200px; height: 200px; }
    .center-node-logo { width: 124px; height: 124px; }
    .center-node-arabic { font-size: 36px; }
    .outer-node { width: 150px; height: 120px; }
    .node-arabic { font-size: 28px; }
}

@media (max-width: 900px) {
    .diagram-container { max-width: 100%; min-height: 520px; }
    .center-node { width: 170px; height: 170px; padding: 0.9rem 1.1rem; border-radius: 16px; }
    .center-node-logo { width: 108px; height: 108px; }
    .center-node-arabic { font-size: 1.9rem; }
    .outer-node { width: 150px; padding: 0.7rem 0.9rem; border-radius: 14px; gap: 0.2rem; }
    .node-arabic { font-size: 1.5rem; }
    .node-sub { font-size: 1rem; }
    .ecosystem-section { padding: 2rem 1rem 2.5rem; }
}

/* Промежуточный диапазон 700-820px: нижние 4 ноды тесно — уменьшаем ширину */
@media (max-width: 820px) {
    .outer-node {
        width: 128px !important;
        height: 108px !important;
        padding: 0.5rem 0.6rem !important;
    }
    .node-arabic { font-size: 1.4rem !important; }
    .node-sub    { font-size: 0.88rem !important; }
}

/* Mobile */
@media (max-width: 700px) {
    header { padding: 35px 20px 25px; }
    
    .header-controls { 
        top: 15px; 
        right: 15px; 
        gap: 10px;
    }
    
    .header-auth-btn span { display: none; }
    .header-auth-btn { padding: 8px 10px; }

    .lang-current-label { display: none; }
    .lang-trigger { padding: 7px 9px; gap: 3px; }
    
    .logo-arabic { font-size: 48px; }
    .ecosystem-title { font-size: 20px; margin-bottom: 35px; }
    
    .diagram-container {
        transform: scale(0.85);
        transform-origin: center top;
        height: 550px;
        margin: 0 auto;
    }
    
    .ecosystem-section {
        overflow-x: hidden;
        padding: 2rem 0.5rem;
    }

    .center-node { width: 130px !important; height: 130px !important; min-width: 130px !important; padding: 0.5rem !important; }
    .center-node-logo { width: 76px !important; height: 76px !important; margin-bottom: 2px !important; }
    .center-node-arabic { font-size: 1.6rem !important; }

    .outer-node { width: 110px !important; height: 110px !important; min-width: 110px !important; padding: 0.5rem 0.7rem !important; }
    .node-arabic { font-size: 1.5rem !important; }
    .node-sub { font-size: 0.8rem !important; }
    .node-icon { width: 17px !important; height: 17px !important; margin-bottom: 2px !important; }

    /* Верх */
    .node-hadith { top: 15% !important; left: 7% !important; }
    .node-quran  { top: 12% !important; }
    .node-atlas  { top: 12% !important; }
    .node-ifta   { top: 15% !important; right: 7% !important; }
    /* Середина */
    .node-calendar   { left: 8% !important; }
    .node-dictionary { right: 8% !important; }
    /* Низ (4 ноды) */
    .node-halal        { bottom: 17% !important; left: 3% !important; }
    .node-digitization { bottom: 12% !important; left: 38% !important; transform: translateX(-50%) !important; }
    .node-maliya       { bottom: 12% !important; right: 38% !important; transform: translateX(50%) !important; }
    .node-books        { bottom: 17% !important; right: 3% !important; }

    .ecosystem-section { padding-top: 0 !important; margin-top: -20px !important; padding-bottom: 0 !important; margin-bottom: -30px !important; }
    .diagram-container { margin-top: -30px !important; transform: scale(0.85); height: 500px !important; }
    footer { padding-top: 30px !important; }
    
    /* Modal responsive */
    .modal-container { width: 95%; max-width: none; border-radius: var(--radius-lg); }
    .modal-header { padding: 24px 24px 0; }
    .auth-tabs { margin: 20px 24px 0; }
    .auth-form { padding: 20px 24px 28px; }
    .form-row { flex-direction: column; gap: 0; }
    
    .toast { right: 12px; left: 12px; max-width: none; }
}

@media (max-width: 535px) {
    .tagline { font-size: 14px !important; line-height: 1.4 !important; padding: 0 15px !important; }
    .ecosystem-title { margin-bottom: 10px !important; font-size: 18px !important; }

    /* Горизонтальный скролл — компактная диаграмма 520×480px */
    .ecosystem-section {
        overflow-x: auto !important;
        overflow-y: visible !important;
        padding: 0 !important;
        margin-top: 0 !important;
        margin-bottom: 0 !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }
    .ecosystem-section::-webkit-scrollbar { display: none; }
    .diagram-container {
        width: 520px !important;
        max-width: 520px !important;
        height: 480px !important;
        transform: none !important;
        margin-top: 0 !important;
    }

    /* Компактные ноды — позиции рассчитаны по SVG-координатам при масштабе 520×480 */
    .outer-node  { width: 95px !important; height: 95px !important; padding: 0.4rem 0.5rem !important; }
    .node-arabic { font-size: 1.25rem !important; }
    .node-sub    { font-size: 0.72rem !important; }
    .node-icon   { width: 15px !important; height: 15px !important; margin-bottom: 2px !important; }

    /* Верх */
    .node-hadith { top: 18% !important; left: 6% !important; }
    .node-quran  { top: 14% !important; }
    .node-atlas  { top: 14% !important; }
    .node-ifta   { top: 18% !important; right: 6% !important; }
    /* Середина */
    .node-calendar   { left: 7.5% !important; }
    .node-dictionary { right: 7.5% !important; }
    /* Низ */
    .node-halal        { bottom: 18% !important; left: 3% !important; }
    .node-digitization { bottom: 15% !important; left: 37.5% !important; transform: translateX(-50%) !important; }
    .node-maliya       { bottom: 15% !important; right: 37.5% !important; transform: translateX(50%) !important; }
    .node-books        { bottom: 18% !important; right: 3% !important; }

    footer { margin-top: 0 !important; padding-top: 20px !important; }
}