/**
 * Мобильная оптимизация для Soprano Exchange
 * Адаптивные стили для всех страниц
 */

/* ========== ОБЩИЕ МОБИЛЬНЫЕ СТИЛИ ========== */

@media (max-width: 768px) {
    /* Базовые настройки */
    body {
        font-size: 14px;
        overflow-x: hidden;
    }

    /* Контейнеры */
    .admin-container,
    .merchant-container,
    .api-container {
        padding: 80px 15px 30px !important;
        max-width: 100% !important;
    }

    /* Заголовки */
    .admin-header h1,
    .merchant-header h1,
    .api-header h1 {
        font-size: 1.8rem !important;
        line-height: 1.3;
    }

    .admin-header,
    .merchant-header,
    .api-header {
        padding: 1.5rem 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    /* Навигация */
    nav {
        padding: 1rem !important;
    }

    nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    nav ul li {
        width: 100%;
        text-align: center;
    }

    nav ul li a {
        display: block;
        padding: 0.8rem 1rem;
        font-size: 0.9rem;
    }

    /* Вкладки */
    .tabs {
        flex-direction: column;
        gap: 0.5rem;
        border-bottom: none !important;
    }

    .tab {
        width: 100%;
        padding: 0.8rem 1rem !important;
        text-align: center;
        border: 1px solid var(--border-gold) !important;
        border-radius: 8px;
        margin-bottom: 0 !important;
    }

    .tab.active {
        background: rgba(212, 175, 55, 0.1);
        border-color: var(--accent-gold) !important;
    }

    /* Карточки секций */
    .section-card {
        padding: 1.5rem 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .section-card h2 {
        font-size: 1.5rem !important;
        margin-bottom: 1rem !important;
    }

    /* Режимы работы */
    .payment-modes {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .mode-card {
        padding: 1.5rem 1rem !important;
    }

    .mode-card h3 {
        font-size: 1.3rem !important;
    }

    .mode-card p {
        font-size: 0.9rem !important;
    }

    /* Формы */
    .form-group {
        margin-bottom: 1.2rem !important;
    }

    .form-group label {
        font-size: 0.9rem !important;
        margin-bottom: 0.5rem !important;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 1rem !important;
        padding: 0.8rem !important;
    }

    /* Кнопки */
    .btn,
    button[type="submit"],
    .cta-button {
        width: 100%;
        padding: 1rem !important;
        font-size: 1rem !important;
        margin-bottom: 0.5rem;
    }

    .btn-group {
        flex-direction: column;
        gap: 0.5rem;
    }

    /* Таблицы */
    .table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        min-width: 800px;
        font-size: 0.85rem;
    }

    table th,
    table td {
        padding: 0.6rem 0.4rem !important;
        white-space: nowrap;
    }

    /* Merchant Cards */
    .merchant-card {
        padding: 1.5rem 1rem !important;
    }

    .merchant-card h3 {
        font-size: 1.2rem !important;
    }

    .api-key-display {
        font-size: 0.75rem !important;
        padding: 0.8rem !important;
        word-break: break-all;
    }

    /* API Documentation */
    .endpoint-card {
        padding: 1.5rem 1rem !important;
        margin-bottom: 1.5rem !important;
    }

    .endpoint-card h3 {
        font-size: 1.3rem !important;
    }

    .code-block {
        font-size: 0.8rem !important;
        padding: 1rem !important;
        overflow-x: auto;
    }

    pre {
        white-space: pre-wrap;
        word-wrap: break-word;
    }

    /* Статистика */
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }

    .stat-card {
        padding: 1.2rem 1rem !important;
    }

    .stat-value {
        font-size: 1.8rem !important;
    }

    /* Модальные окна */
    .modal-content {
        width: 95% !important;
        max-width: 95% !important;
        margin: 10px auto !important;
        padding: 1.5rem 1rem !important;
    }

    /* Уведомления */
    .notification,
    .alert {
        font-size: 0.9rem !important;
        padding: 1rem !important;
        margin: 1rem 0 !important;
    }

    /* Скрыть на мобильных */
    .desktop-only {
        display: none !important;
    }

    /* Показать только на мобильных */
    .mobile-only {
        display: block !important;
    }
}

/* ========== ПЛАНШЕТЫ (768px - 1024px) ========== */

@media (min-width: 769px) and (max-width: 1024px) {
    .admin-container,
    .merchant-container,
    .api-container {
        padding: 90px 30px 40px !important;
    }

    .payment-modes {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    .tabs {
        flex-wrap: wrap;
    }

    .tab {
        flex: 1;
        min-width: 150px;
    }

    table {
        font-size: 0.9rem;
    }
}

/* ========== МАЛЕНЬКИЕ МОБИЛЬНЫЕ (до 480px) ========== */

@media (max-width: 480px) {
    body {
        font-size: 13px;
    }

    .admin-header h1,
    .merchant-header h1,
    .api-header h1 {
        font-size: 1.5rem !important;
    }

    .section-card h2 {
        font-size: 1.3rem !important;
    }

    .mode-card h3 {
        font-size: 1.1rem !important;
    }

    .btn,
    button[type="submit"] {
        font-size: 0.95rem !important;
        padding: 0.9rem !important;
    }

    table {
        font-size: 0.75rem;
    }

    .code-block {
        font-size: 0.7rem !important;
    }

    .stat-value {
        font-size: 1.5rem !important;
    }
}

/* ========== ЛАНДШАФТНАЯ ОРИЕНТАЦИЯ ========== */

@media (max-width: 768px) and (orientation: landscape) {
    .admin-container,
    .merchant-container,
    .api-container {
        padding-top: 70px !important;
    }

    .admin-header,
    .merchant-header,
    .api-header {
        padding: 1rem !important;
    }

    .admin-header h1,
    .merchant-header h1,
    .api-header h1 {
        font-size: 1.5rem !important;
    }
}

/* ========== УЛУЧШЕНИЯ UX ДЛЯ МОБИЛЬНЫХ ========== */

@media (max-width: 768px) {
    /* Увеличенные области нажатия */
    button,
    a,
    input[type="checkbox"],
    input[type="radio"] {
        min-height: 44px;
        min-width: 44px;
    }

    /* Улучшенная читаемость */
    p,
    li,
    td {
        line-height: 1.6;
    }

    /* Оптимизация скролла */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    /* Плавная прокрутка */
    html {
        scroll-behavior: smooth;
    }

    /* Фиксированная навигация */
    nav {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 1000;
        background: rgba(10, 10, 10, 0.98);
        backdrop-filter: blur(10px);
    }

    /* Отступ для контента под фиксированной навигацией */
    body {
        padding-top: 60px;
    }
}

/* ========== ТЕМНАЯ ТЕМА ДЛЯ МОБИЛЬНЫХ ========== */

@media (max-width: 768px) and (prefers-color-scheme: dark) {
    body {
        background: #000;
    }

    .section-card,
    .mode-card,
    .merchant-card,
    .endpoint-card {
        background: rgba(20, 20, 20, 0.98);
    }
}

/* ========== ДОСТУПНОСТЬ ========== */

@media (max-width: 768px) {
    /* Увеличенный фокус для клавиатурной навигации */
    *:focus {
        outline: 3px solid var(--accent-gold);
        outline-offset: 2px;
    }

    /* Улучшенная видимость текста */
    body {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}