/* Responsive Design для SetiAI */

/* Mobile First Approach */
@media (max-width: 768px) {
    /* Навигация */
    .navbar {
        flex-direction: column;
        padding: 1rem;
    }
    
    .navbar-menu {
        flex-direction: column;
        width: 100%;
        margin-top: 1rem;
    }
    
    .navbar-menu-item {
        width: 100%;
        margin: 0.25rem 0;
    }
    
    /* Карточки постов */
    .post-card {
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .post-card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .post-card-actions {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    /* Сайдбар */
    .sidebar {
        position: fixed;
        left: -100%;
        width: 80%;
        max-width: 300px;
        transition: left 0.3s ease;
        z-index: 1000;
        height: 100vh;
        overflow-y: auto;
    }
    
    .sidebar.open {
        left: 0;
    }
    
    /* Модальные окна */
    .modal {
        width: 95%;
        max-width: 95%;
        margin: 1rem auto;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    /* Формы */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-input,
    .form-textarea {
        width: 100%;
        padding: 0.75rem;
        font-size: 16px; /* Предотвращает zoom на iOS */
    }
    
    /* Кнопки */
    .btn {
        width: 100%;
        padding: 0.75rem 1rem;
        margin-bottom: 0.5rem;
    }
    
    /* Виджеты */
    .widget {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    /* Таблицы */
    .table-container {
        overflow-x: auto;
    }
    
    table {
        min-width: 600px;
        font-size: 0.875rem;
    }
    
    /* Сетка */
    .grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .grid-2 {
        grid-template-columns: 1fr;
    }
    
    .grid-3 {
        grid-template-columns: 1fr;
    }
    
    /* Поиск */
    .search-container {
        width: 100%;
    }
    
    .search-input {
        width: 100%;
    }
}

/* Tablet */
@media (min-width: 769px) and (max-width: 1024px) {
    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .sidebar {
        width: 250px;
    }
    
    .main-content {
        margin-left: 250px;
    }
}

/* Desktop */
@media (min-width: 1025px) {
    .container {
        max-width: 1200px;
        margin: 0 auto;
        padding: 0 2rem;
    }
}

/* Улучшения для touch устройств */
@media (hover: none) and (pointer: coarse) {
    /* Увеличиваем размеры кликабельных элементов */
    .btn,
    .clickable,
    button,
    a {
        min-height: 44px;
        min-width: 44px;
        padding: 0.75rem 1rem;
    }
    
    /* Улучшаем видимость фокуса */
    .btn:focus,
    button:focus,
    a:focus {
        outline: 2px solid #667eea;
        outline-offset: 2px;
    }
}

/* Индикаторы загрузки */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-container {
    background: #1a202c;
    padding: 2rem;
    border-radius: 0.5rem;
    text-align: center;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #2d3748 25%, #4a5568 50%, #2d3748 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.skeleton-text {
    height: 1rem;
    border-radius: 0.25rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

/* Улучшения доступности */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Улучшения для скролла */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #1a202c;
}

::-webkit-scrollbar-thumb {
    background: #4a5568;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #718096;
}

/* Печать */
@media print {
    .no-print {
        display: none !important;
    }
    
    .sidebar,
    .navbar,
    .btn {
        display: none !important;
    }
}

