/* Адаптивные стили для мобильных устройств */

/* Планшеты и меньше */
@media (max-width: 768px) {
    .admin-container {
        padding: 15px;
        max-width: 100%;
    }
    
    .admin-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
        padding-bottom: 15px;
    }
    
    .admin-header h1 {
        font-size: 24px;
        width: 100%;
    }
    
    .admin-header .user-info {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .admin-header > div.header-buttons,
    .admin-header .header-buttons {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    
    .admin-header > div.header-buttons .btn,
    .admin-header .header-buttons .btn {
        width: 100%;
        margin-left: 0 !important;
    }
    
    .admin-nav {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .players-table,
    .games-table,
    .schedule-table {
        overflow: hidden;
        margin: 0;
        padding: 0;
        border-radius: 12px;
    }
    
    .schedule-table .table-wrapper,
    .players-table .table-wrapper,
    .games-table .table-wrapper {
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        padding: 0;
        width: 100%;
        display: block;
    }
    
    .players-table table,
    .games-table table,
    .schedule-table table {
        min-width: 600px;
        font-size: 14px;
        display: table;
        width: 100%;
    }
    
    table {
        font-size: 14px;
    }
    
    th, td {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    .actions-cell {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .actions-cell .btn {
        width: 100%;
        justify-content: center;
        margin: 0;
    }
    
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        padding: 20px;
        width: 95%;
        max-width: 100%;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .form-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .form-actions .btn {
        width: 100%;
    }
    
    .color-schemes-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .color-scheme-card {
        padding: 15px;
    }
    
    .scheme-colors {
        margin-bottom: 10px;
    }
    
    .register-container,
    .login-container {
        padding: 25px 20px;
        max-width: 100%;
    }
    
    /* Улучшения для таблиц на мобильных */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    /* Скрываем менее важные колонки на маленьких экранах */
    .table-mobile-hidden {
        display: none;
    }
    
    /* Адаптивность для элементов файлов */
    .file-item {
        flex-direction: column !important;
        align-items: flex-start !important;
    }
    
    .file-item > div:first-child {
        width: 100%;
        margin-bottom: 8px;
    }
    
    .file-item > div:nth-child(2) {
        width: 100%;
        margin-bottom: 8px;
        margin-right: 0 !important;
    }
    
    .file-item > div:last-child {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    
    .file-item > div:last-child > button {
        width: 100%;
        justify-content: center;
    }
}

/* Мобильные устройства */
@media (max-width: 480px) {
    .admin-container {
        padding: 10px;
    }
    
    .admin-header {
        margin-bottom: 20px;
        padding-bottom: 15px;
    }
    
    .admin-header h1 {
        font-size: 20px;
        line-height: 1.3;
    }
    
    .admin-header .user-info {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        width: 100%;
    }
    
    .admin-header .user-info span {
        width: 100%;
        font-size: 14px;
        text-align: center;
        padding: 8px;
        background: var(--admin-border);
        border-radius: 6px;
    }
    
    .admin-header .header-buttons {
        width: 100%;
        flex-direction: column;
        gap: 10px;
    }
    
    .admin-header .header-buttons .btn,
    .admin-header .header-buttons .btn-logout {
        width: 100%;
        margin: 0;
    }
    
    .admin-nav {
        gap: 12px;
    }
    
    .admin-nav-card {
        flex-direction: row;
        text-align: left;
        padding: 15px;
        gap: 15px;
    }
    
    .admin-nav-card i {
        font-size: 28px;
        flex-shrink: 0;
    }
    
    .admin-nav-card-content {
        flex: 1;
    }
    
    .admin-nav-card-content h3 {
        font-size: 18px;
        margin-bottom: 5px;
    }
    
    .admin-nav-card-content p {
        font-size: 12px;
    }
    
    .stat-card {
        padding: 15px;
    }
    
    .stat-card .stat-value {
        font-size: 24px;
    }
    
    .players-table,
    .games-table,
    .schedule-table {
        border-radius: 8px;
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    
    .schedule-table .table-wrapper,
    .players-table .table-wrapper,
    .games-table .table-wrapper {
        padding: 0;
        width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        display: block;
    }
    
    .players-table table,
    .games-table table,
    .schedule-table table {
        min-width: 500px;
        font-size: 12px;
        display: table;
        width: 100%;
    }
    
    table {
        font-size: 12px;
    }
    
    /* Специальные стили для таблицы расписания */
    .schedule-table th:nth-child(5),
    .schedule-table th:nth-child(6),
    .schedule-table td:nth-child(5),
    .schedule-table td:nth-child(6) {
        min-width: 120px;
    }
    
    .schedule-table th:nth-child(7),
    .schedule-table td:nth-child(7) {
        min-width: 180px;
    }
    
    th, td {
        padding: 8px 5px;
      
    }
    
    .avatar-cell img {
        max-width: 50px;
        max-height: 50px;
    }
    
    .btn-sm {
        padding: 6px 10px;
        font-size: 12px;
        min-height: 36px;
    }
    
    .modal {
        padding: 5px;
    }
    
    .modal-content {
        padding: 15px;
        width: 98%;
        max-height: 95vh;
    }
    
    .modal-header {
        margin-bottom: 15px;
    }
    
    .modal-header h2 {
        font-size: 18px;
    }
    
    .modal-close {
        font-size: 28px;
        width: 36px;
        height: 36px;
    }
    
    .form-group {
        margin-bottom: 15px;
    }
    
    .form-group label {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .form-group input,
    .form-group select {
        padding: 10px;
        font-size: 14px;
        min-height: 44px;
    }
    
    .file-info {
        font-size: 11px;
        margin-top: 4px;
    }
    
    .register-container,
    .login-container {
        padding: 20px 15px;
    }
    
    .register-header h1,
    .login-header h1 {
        font-size: 22px;
    }
    
    .register-header p,
    .login-header p {
        font-size: 13px;
    }
    
    .info-box {
        padding: 12px;
        font-size: 13px;
    }
    
    .btn-login {
        padding: 12px;
        font-size: 14px;
        min-height: 44px;
    }
    
    #avatarPreviewImg {
        max-width: 150px;
        max-height: 150px;
    }
    
    .upload-progress {
        padding: 12px;
    }
    
    .upload-progress__header {
        margin-bottom: 10px;
    }
    
    .upload-progress__title {
        font-size: 13px;
    }
    
    .upload-progress__text {
        font-size: 12px;
    }
    
    .upload-progress__stats {
        font-size: 11px;
        gap: 12px;
        flex-direction: column;
    }
    
    .upload-progress__stats span {
        display: block;
    }
    
    .color-scheme-card {
        padding: 15px;
    }
    
    .scheme-name {
        font-size: 18px;
    }
    
    .scheme-description {
        font-size: 13px;
    }
    
    .color-preview {
        width: 40px;
        height: 40px;
    }
    
    .activate-btn {
        padding: 10px;
        font-size: 14px;
    }
}

/* Очень маленькие экраны */
@media (max-width: 360px) {
    .admin-container {
        padding: 8px;
    }
    
    .admin-header {
        margin-bottom: 15px;
        padding-bottom: 12px;
    }
    
    .admin-header h1 {
        font-size: 18px;
    }
    
    .admin-header .user-info span {
        font-size: 12px;
    }
    
    .admin-nav-card {
        padding: 12px;
        gap: 12px;
    }
    
    .admin-nav-card i {
        font-size: 24px;
    }
    
    .admin-nav-card-content h3 {
        font-size: 16px;
    }
    
    .stat-card {
        padding: 12px;
    }
    
    .stat-card .stat-value {
        font-size: 20px;
    }
    
    .players-table,
    .games-table,
    .schedule-table {
        margin: 0;
        padding: 0;
        overflow: hidden;
    }
    
    .schedule-table .table-wrapper,
    .players-table .table-wrapper,
    .games-table .table-wrapper {
        padding: 0;
        width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
        display: block;
    }
    
    .players-table table,
    .games-table table,
    .schedule-table table {
        min-width: 400px;
        font-size: 11px;
        display: table;
        width: 100%;
    }
    
    table {
        font-size: 11px;
    }
    
    th, td {
        padding: 6px 4px;
    }
    
    /* Уменьшаем размеры колонок в расписании на очень маленьких экранах */
    .schedule-table th,
    .schedule-table td {
        font-size: 10px;
        padding: 5px 3px;
    }
    
    .schedule-table .actions-cell {
        min-width: 160px;
    }
    
    .schedule-table .btn-sm {
        padding: 4px 6px;
        font-size: 10px;
        min-height: 32px;
    }
    
    .btn-sm {
        padding: 5px 8px;
        font-size: 11px;
        min-height: 32px;
    }
    
    .modal-content {
        padding: 12px;
        width: 98%;
    }
    
    .modal-header h2 {
        font-size: 16px;
    }
    
    .form-group input,
    .form-group select {
        padding: 8px;
        font-size: 13px;
    }
    
    .register-container,
    .login-container {
        padding: 15px 12px;
    }
    
    .register-header h1,
    .login-header h1 {
        font-size: 20px;
    }
    
    .color-scheme-card {
        padding: 12px;
    }
    
    .scheme-name {
        font-size: 16px;
    }
    
    .color-preview {
        width: 35px;
        height: 35px;
    }
}

/* Горизонтальная ориентация на мобильных */
@media (max-width: 768px) and (orientation: landscape) {
    .admin-header {
        flex-direction: row;
        align-items: center;
        flex-wrap: wrap;
    }
    
    .admin-header h1 {
        font-size: 20px;
    }
    
    .admin-header .user-info {
        width: auto;
        flex-direction: row;
    }
    
    .admin-header > div {
        width: auto;
        flex-direction: row;
    }
    
    .admin-header > div .btn {
        width: auto;
    }
    
    .modal-content {
        max-height: 85vh;
        padding: 15px;
    }
    
    .admin-nav {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Улучшения для touch устройств */
@media (hover: none) and (pointer: coarse) {
    .btn {
        min-height: 44px;
        min-width: 44px;
        touch-action: manipulation;
    }
    
    .btn-sm {
        min-height: 40px;
    }
    
    .modal-close {
        min-width: 44px;
        min-height: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
        touch-action: manipulation;
    }
    
    .form-group input,
    .form-group select {
        min-height: 44px;
        touch-action: manipulation;
    }
    
    .form-group input[type="file"] {
        min-height: 44px;
        padding: 8px;
    }
    
    tbody tr {
        cursor: pointer;
    }
    
    .admin-nav-card {
        touch-action: manipulation;
    }
    
    .color-scheme-card {
        touch-action: manipulation;
    }
    
    /* Увеличиваем область клика для маленьких элементов */
    .actions-cell .btn {
        padding: 8px 12px;
    }
    
    /* Улучшаем скролл на touch устройствах */
    .players-table .table-wrapper,
    .games-table .table-wrapper,
    .schedule-table .table-wrapper {
        -webkit-overflow-scrolling: touch;
        scroll-behavior: smooth;
    }
    
    .modal-content {
        -webkit-overflow-scrolling: touch;
    }
}

