/* responsive.css - Адаптивные стили для Auction Game */

/* =============================================
   БАЗОВЫЕ АДАПТИВНЫЕ НАСТРОЙКИ
   ============================================= */

/* Базовая адаптивность для всех устройств */
* {
    box-sizing: border-box;
}

img {
    max-width: 100%;
    height: auto;
}

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

/* Адаптивная типографика */
html {
    font-size: 16px; /* Базовый размер */
}

/* =============================================
   КОНТЕЙНЕРЫ И СЕТКИ
   ============================================= */

.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

.container-fluid {
    width: 100%;
    padding: 0 15px;
}

/* Адаптивная сетка */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -15px;
}

.col {
    flex: 1;
    padding: 0 15px;
}

.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

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

@media (max-width: 1024px) {
    .container {
        max-width: 960px;
        padding: 0 20px;
    }
    
    /* Типографика для планшетов */
    html {
        font-size: 15px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
    
    /* Навигация */
    .nav {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .nav a {
        text-align: center;
        padding: 12px 16px;
    }
    
    /* Карточки */
    .card {
        margin-bottom: 1rem;
    }
    
    /* Кнопки */
    .btn {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
    
    /* Формы */
    .form-group {
        margin-bottom: 1.25rem;
    }
    
    .form-control {
        padding: 12px 15px;
        font-size: 1rem;
    }
    
    /* Аукцион */
    .auction-main-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .timer-display {
        font-size: 2.5rem;
    }
    
    .bank-amount {
        font-size: 2.5rem;
    }
    
    .bid-buttons {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.75rem;
    }
    
    .bid-button {
        padding: 12px 8px;
        font-size: 1rem;
    }
    
    /* Чат */
    .chat-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .online-users-sidebar {
        order: -1;
        height: auto;
        max-height: 200px;
    }
    
    .chat-messages-container {
        height: 400px;
    }
    
    /* Админ-панель */
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .admin-nav-list {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .admin-table {
        font-size: 0.9rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.75rem 0.5rem;
    }
}

/* =============================================
   МОБИЛЬНЫЕ УСТРОЙСТВА (320px - 768px)
   ============================================= */

@media (max-width: 768px) {
    .container {
        max-width: 100%;
        padding: 0 15px;
    }
    
    /* Типографика для мобильных */
    html {
        font-size: 14px;
    }
    
    h1 { font-size: 1.75rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.25rem; }
    h4 { font-size: 1.1rem; }
    
    /* Мобильные колонки */
    .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
    .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
    .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
    .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
    .col-sm-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
    .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
    .col-sm-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
    .col-sm-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
    .col-sm-9 { flex: 0 0 75%; max-width: 75%; }
    .col-sm-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
    .col-sm-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
    .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
    
    /* Навигация */
    .navbar { padding: 0.5rem 0; min-height: 52px; }
    .navbar .container { gap: 0.5rem; }
    .logo { width: 24px; height: 24px; }
    .site-title { font-size: 1.05rem; }
    .nav-menu { gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
    .nav-list { display: none; }
    .quick-nav { display: block; }
    .nav-link { padding: 0.55rem 0.7rem; font-size: 0.95rem; border-radius: 12px; }
    .navbar-spacer { height: 148px; }
    
    /* Карточки */
    .card {
        margin-bottom: 1rem;
        padding: 1rem;
    }
    
    /* Кнопки */
    .btn {
        width: 100%;
        padding: 15px;
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }
    
    .btn-group {
        flex-direction: column;
    }
    
    .btn-group .btn {
        margin-right: 0;
        margin-bottom: 0.5rem;
        border-radius: 6px;
    }
    
    /* Формы */
    .form-group {
        margin-bottom: 1rem;
    }
    
    .form-control {
        width: 100%;
        padding: 15px;
        font-size: 16px; /* Предотвращает зум на iOS */
        border-radius: 8px;
    }
    
    .form-row {
        flex-direction: column;
    }
    
    .form-row .form-group {
        margin-right: 0;
    }
    
    /* Аукцион - мобильная версия */
    .auction-container {
        padding: 1rem 0;
    }
    
    .auction-main-card {
        padding: 1rem;
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    .timer-display {
        font-size: 2rem;
        margin-bottom: 0.75rem;
    }
    
    .bank-amount {
        font-size: 2rem;
    }
    
    .current-bid-amount {
        font-size: 1.5rem;
    }
    
    .bid-buttons {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
        margin-bottom: 1rem;
    }
    
    .bid-button {
        padding: 12px 5px;
        font-size: 0.9rem;
        min-height: 50px;
    }
    
    .bid-input-group {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .bid-input {
        padding: 15px;
        font-size: 16px;
    }
    
    .bid-submit {
        padding: 15px;
        width: 100%;
    }
    
    /* История ставок - мобильная */
    .bids-history {
        max-height: 300px;
    }
    
    .bid-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.75rem;
    }
    
    .bid-user {
        width: 100%;
    }
    
    .bid-amount {
        margin-right: 0;
        font-size: 1.1rem;
    }
    
    .bid-time {
        align-self: flex-end;
    }
    
    /* Статистика аукциона */
    .auction-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 1.5rem;
    }
    
    /* Чат - мобильная версия */
    .chat-container {
        grid-template-columns: 1fr;
        height: auto;
        padding: 1rem 0;
    }
    
    .chat-messages-container {
        height: 400px;
        padding: 1rem;
        margin-bottom: 1rem;
    }
    
    .online-users-sidebar {
        height: auto;
        max-height: 150px;
        padding: 1rem;
        order: -1;
    }
    
    .online-users-list {
        max-height: 100px;
    }
    
    .message-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.25rem;
    }
    
    .message-avatar {
        width: 32px;
        height: 32px;
    }
    
    .chat-input-container {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .chat-input {
        min-height: 60px;
        font-size: 16px;
    }
    
    .send-button {
        width: 100%;
        padding: 15px;
        align-self: stretch;
    }
    
    /* Личный кабинет */
    .profile-container {
        padding: 1rem 0;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    
    .profile-avatar {
        width: 80px;
        height: 80px;
    }
    
    .profile-stats {
        grid-template-columns: 1fr;
    }
    
    .profile-tabs {
        flex-direction: column;
    }
    
    .profile-tab {
        text-align: center;
        padding: 15px;
    }
    
    /* Таблицы - мобильная версия */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .table {
        min-width: 600px;
        font-size: 0.8rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    /* Альтернативный вид таблиц для мобильных */
    .table-mobile {
        display: none;
    }
    
    .table-mobile .table-item {
        background: var(--bg-card);
        border-radius: 8px;
        padding: 1rem;
        margin-bottom: 0.5rem;
        border-left: 4px solid var(--primary-color);
    }
    
    .table-mobile .item-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 0.5rem;
        font-weight: 600;
    }
    
    .table-mobile .item-details {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        font-size: 0.9rem;
    }
    
    .table-mobile .item-actions {
        margin-top: 0.75rem;
        display: flex;
        gap: 0.5rem;
    }
    
    .table-mobile .item-actions .btn {
        flex: 1;
        padding: 8px;
        font-size: 0.8rem;
    }
    
    /* Админ-панель - мобильная */
    .admin-container {
        padding: 1rem;
    }
    
    .admin-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
        padding: 1rem;
    }
    
    .admin-stats {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .admin-nav-list {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .admin-nav-link {
        justify-content: center;
        padding: 15px;
    }
    
    .admin-content {
        padding: 1rem;
    }
    
    .admin-form-row {
        grid-template-columns: 1fr;
    }
    
    .admin-btn-group {
        flex-direction: column;
    }
    
    .admin-modal-content {
        width: 95%;
        padding: 1rem;
        margin: 1rem;
    }
    
    /* Модальные окна */
    .modal-content {
        width: 95%;
        margin: 1rem;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
        margin-bottom: 0.5rem;
    }
}

/* =============================================
   МАЛЫЕ МОБИЛЬНЫЕ УСТРОЙСТВА (320px - 480px)
   ============================================= */

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    /* Типографика для малых экранов */
    html {
        font-size: 13px;
    }
    
    h1 { font-size: 1.5rem; }
    h2 { font-size: 1.3rem; }
    h3 { font-size: 1.1rem; }
    h4 { font-size: 1rem; }
    
    /* Аукцион */
    .auction-main-card {
        padding: 0.75rem;
    }
    
    .timer-display {
        font-size: 1.75rem;
    }
    
    .bank-amount {
        font-size: 1.75rem;
    }
    
    .bid-buttons {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
    
    .bid-button {
        padding: 15px;
        font-size: 1rem;
        min-height: 55px;
    }
    
    /* Чат */
    .chat-messages-container {
        height: 300px;
        padding: 0.75rem;
    }
    
    .message-avatar {
        width: 28px;
        height: 28px;
    }
    
    .chat-input {
        min-height: 50px;
    }
    
    /* Формы */
    .form-control {
        padding: 12px;
    }
    
    /* Кнопки */
    .btn {
        padding: 12px;
        font-size: 0.9rem;
    }
    
    /* Карточки */
    .card {
        padding: 0.75rem;
    }
    
    /* Админ-панель */
    .admin-content {
        padding: 0.75rem;
    }
    
    .stat-value {
        font-size: 1.75rem;
    }
    
    .admin-table {
        font-size: 0.7rem;
    }
    
    .admin-table th,
    .admin-table td {
        padding: 0.25rem;
    }
}

/* =============================================
   УТИЛИТЫ ДЛЯ АДАПТИВНОСТИ
   ============================================= */

/* Скрытие элементов на разных экранах */
.d-none { display: none !important; }
.d-block { display: block !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }
.d-flex { display: flex !important; }

@media (max-width: 768px) {
    .d-sm-none { display: none !important; }
    .d-sm-block { display: block !important; }
    .d-sm-inline { display: inline !important; }
    .d-sm-inline-block { display: inline-block !important; }
    .d-sm-flex { display: flex !important; }
}

@media (min-width: 769px) {
    .d-md-none { display: none !important; }
    .d-md-block { display: block !important; }
    .d-md-inline { display: inline !important; }
    .d-md-inline-block { display: inline-block !important; }
    .d-md-flex { display: flex !important; }
}

/* Выравнивание текста */
.text-left { text-align: left; }
.text-center { text-align: center; }
.text-right { text-align: right; }

@media (max-width: 768px) {
    .text-sm-left { text-align: left; }
    .text-sm-center { text-align: center; }
    .text-sm-right { text-align: right; }
}

/* Отступы для мобильных */
@media (max-width: 768px) {
    .mt-sm-0 { margin-top: 0 !important; }
    .mt-sm-1 { margin-top: 0.25rem !important; }
    .mt-sm-2 { margin-top: 0.5rem !important; }
    .mt-sm-3 { margin-top: 1rem !important; }
    .mt-sm-4 { margin-top: 1.5rem !important; }
    .mt-sm-5 { margin-top: 3rem !important; }
    
    .mb-sm-0 { margin-bottom: 0 !important; }
    .mb-sm-1 { margin-bottom: 0.25rem !important; }
    .mb-sm-2 { margin-bottom: 0.5rem !important; }
    .mb-sm-3 { margin-bottom: 1rem !important; }
    .mb-sm-4 { margin-bottom: 1.5rem !important; }
    .mb-sm-5 { margin-bottom: 3rem !important; }
    
    .p-sm-0 { padding: 0 !important; }
    .p-sm-1 { padding: 0.25rem !important; }
    .p-sm-2 { padding: 0.5rem !important; }
    .p-sm-3 { padding: 1rem !important; }
    .p-sm-4 { padding: 1.5rem !important; }
    .p-sm-5 { padding: 3rem !important; }
}

/* =============================================
   ОПТИМИЗАЦИЯ ДЛЯ TOUCH УСТРОЙСТВ
   ============================================= */

/* Увеличенные области касания */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .form-control {
        min-height: 44px;
    }
    
    .nav a {
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Убираем hover эффекты на touch устройствах */
    .btn:hover,
    .card:hover,
    .nav a:hover {
        transform: none;
    }
    
    /* Улучшенная прокрутка */
    .chat-messages,
    .table-responsive,
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
}

/* =============================================
   ВЫСОКАЯ ПЛОТНОСТЬ ПИКСЕЛЕЙ (RETINA)
   ============================================= */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    /* Оптимизация для retina дисплеев */
    .logo,
    .avatar,
    .icon {
        image-rendering: -webkit-optimize-contrast;
    }
}

/* =============================================
   ПЕЧАТЬ
   ============================================= */

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .no-print {
        display: none !important;
    }
    
    .container {
        max-width: none;
        padding: 0;
    }
    
    .btn,
    .form-control,
    .nav {
        border: 1px solid #000 !important;
    }
}

/* =============================================
   ACCESSIBILITY (A11Y)
   ============================================= */

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

/* Улучшенный фокус для клавиатурной навигации */
@media (prefers-reduced-motion: no-preference) {
    *:focus {
        outline: 2px solid var(--primary-color);
        outline-offset: 2px;
    }
}

/* Поддержка уменьшенной анимации */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
