/* Сброс и базовые стили */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html {
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    min-height: 100vh;
    overflow-x: hidden;
}

/* Переменные */
:root {
    /* Light Theme */
    --primary: #4361ee;
    --primary-rgb: 67, 97, 238;
    --primary-dark: #3a56d4;
    --secondary: #7209b7;
    --accent: #f72585;
    --success: #22c55e;
    --warning: #f59e0b;
    --danger: #ef4444;
    
    --text: #1f2937;
    --text-light: #6b7280;
    --text-lighter: #9ca3af;
    
    --background: #f9fafb;
    --card-bg: #ffffff;
    --border: #e5e7eb;
    --border-light: #f3f4f6;
    
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    
    --gradient-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #34d399 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #fbbf24 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #f87171 100%);
}

/* Темная тема */
[data-theme="dark"] {
    --primary: #60a5fa;
    --primary-rgb: 96, 165, 250;
    --primary-dark: #3b82f6;
    --secondary: #a855f7;
    --accent: #f472b6;
    --success: #22d3ee;
    --warning: #fbbf24;
    --danger: #f87171;
    
    --text: #f9fafb;
    --text-light: #d1d5db;
    --text-lighter: #9ca3af;
    
    --background: #111827;
    --card-bg: #1f2937;
    --border: #374151;
    --border-light: #4b5563;
    
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.3);
    --shadow-hover: 0 20px 25px -5px rgba(0, 0, 0, 0.3);
    
    --gradient-primary: linear-gradient(135deg, #818cf8 0%, #c084fc 100%);
}

/* Применение переменных */
body {
    background: var(--background);
    color: var(--text);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Контейнер */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Хедер */
.header {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 16px 0;
    backdrop-filter: blur(10px);
    background: rgba(var(--card-bg), 0.95);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon-container {
    width: 40px;
    height: 40px;
    background: var(--gradient-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.logo-icon {
    font-size: 20px;
    color: white;
}

.logo-text h1 {
    font-size: 18px;
    font-weight: 700;
    line-height: 1.2;
}

.logo-text p {
    font-size: 12px;
    color: var(--text-light);
    line-height: 1.2;
}

.header-controls {
    display: flex;
    gap: 8px;
}

.theme-toggle, .refresh-btn {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.theme-toggle:hover, .refresh-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

/* Основной контент */
.main {
    padding: 24px 0 40px;
}

/* Welcome Section */
.welcome-section {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    position: relative;
    overflow: hidden;
}

.welcome-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
}

.welcome-content {
    text-align: center;
}

.welcome-section h2 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 12px;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.welcome-section > p {
    color: var(--text-light);
    font-size: 16px;
    margin-bottom: 20px;
    line-height: 1.6;
}

.welcome-stats {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.welcome-stat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: var(--radius);
    color: var(--primary);
    font-size: 14px;
    font-weight: 500;
}

.welcome-stat i {
    font-size: 14px;
}

/* Projects Grid */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.project-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary);
}

.project-icon {
    width: 56px;
    height: 56px;
    background: var(--gradient-primary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 24px;
    color: white;
}

.project-title {
    font-size: 20px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.project-description {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.project-status {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 0;
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border-light);
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

.status-badge.online {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-badge.offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-dot {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.players-count {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
}

.players-count i {
    font-size: 12px;
}

.project-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 20px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: var(--radius);
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
}

.project-link:hover {
    background: rgba(var(--primary-rgb), 0.2);
}

.project-link i {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.project-link:hover i {
    transform: translateX(4px);
}

/* Stats Section */
.stats-section {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 32px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary);
    font-size: 20px;
}

.stat-content h3 {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--text);
}

.stat-content p {
    font-size: 14px;
    color: var(--text-light);
}

/* Server Info */
.server-info-section {
    margin-bottom: 32px;
}

.server-info-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
}

.server-info-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}

.server-info-header i {
    font-size: 20px;
    color: var(--primary);
}

.server-info-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.server-info-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.server-info-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.info-label {
    font-size: 12px;
    color: var(--text-light);
    font-weight: 500;
}

.info-value {
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    font-family: 'Monaco', 'Consolas', monospace;
}

.status-active {
    color: #22c55e;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-active::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

/* Футер */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 32px 0 24px;
    margin-top: 32px;
}

.footer-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.footer-info {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.footer-logo i {
    color: var(--primary);
}

.footer-copyright {
    color: var(--text-light);
    font-size: 14px;
    line-height: 1.6;
}

.footer-version {
    display: inline-block;
    padding: 2px 8px;
    background: rgba(var(--primary-rgb), 0.1);
    border-radius: 10px;
    margin-left: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--primary);
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-link {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
}

.footer-link:hover {
    color: var(--primary);
}

.footer-link i {
    font-size: 12px;
    width: 16px;
}

.footer-stats {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-light);
}

.footer-stat {
    display: flex;
    align-items: center;
    gap: 6px;
}

.footer-stat i {
    font-size: 10px;
}



/* Медиа-запросы для планшетов */
@media (max-width: 640px) {
    .container {
        padding: 0 24px;
    }
    
    .logo-text h1 {
        font-size: 20px;
    }
    
    .logo-text p {
        font-size: 14px;
    }
    
    .theme-toggle, .refresh-btn {
        width: 44px;
        height: 44px;
        font-size: 18px;
    }
    
    .welcome-section {
        padding: 32px;
    }
    
    .welcome-section h2 {
        font-size: 28px;
    }
    
    .welcome-stats {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .projects-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 100%;
    }

    .project-card {
        padding: 24px;
    }
    
    .stats-section {
        grid-template-columns: repeat(4, 1fr);
    }
    
    .server-info-content {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .footer-content {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
    
    .footer-info {
        flex: 1;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 12px;
        min-width: 150px;
    }
    
    .footer-stats {
        min-width: 120px;
    }
}

/* Медиа-запросы для десктопов */
@media (min-width: 1024px) {
    .projects-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .welcome-section {
        padding: 40px;
    }
    
    .welcome-section h2 {
        font-size: 32px;
    }
    
    .welcome-section > p {
        font-size: 18px;
    }
    
    .project-card {
        padding: 32px;
    }
    
    .project-title {
        font-size: 22px;
    }
    
    .project-description {
        font-size: 15px;
    }
    
    .stat-card {
        padding: 24px;
    }
    
    .stat-content h3 {
        font-size: 28px;
    }
    
    .footer-copyright {
        font-size: 15px;
    }
}

/* Планшеты в альбомной ориентации и небольшие ноутбуки */
@media (min-width: 768px) and (max-width: 1023px) {
    .projects-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Исправления для iOS Safari */
@supports (-webkit-touch-callout: none) {
    .header {
        position: -webkit-sticky;
    }
    
    .theme-toggle, .refresh-btn {
        -webkit-appearance: none;
    }
    
    input, textarea, select {
        font-size: 16px; /* Предотвращает увеличение в iOS */
    }
}

/* Улучшения для темной темы на мобильных */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #60a5fa;
        --primary-rgb: 96, 165, 250;
        --text: #f9fafb;
        --background: #111827;
        --card-bg: #1f2937;
        --border: #374151;
    }
}

/* Анимации для плавности */
@media (prefers-reduced-motion: no-preference) {
    .project-card, .stat-card, .server-info-card {
        animation: fadeInUp 0.6s ease-out;
    }
    
    @keyframes fadeInUp {
        from {
            opacity: 0;
            transform: translateY(20px);
        }
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Улучшение доступности */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Ховеры только для устройств с мышью */
@media (hover: hover) and (pointer: fine) {
    .project-card:hover {
        transform: translateY(-4px);
    }
    
    .project-link:hover {
        background: rgba(var(--primary-rgb), 0.2);
    }
}

/* Скрытие лишнего на очень маленьких экранах */
@media (max-width: 320px) {
    .logo-text h1 {
        font-size: 16px;
    }
    
    .logo-text p {
        font-size: 11px;
    }
    
    .welcome-stat {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .stats-section {
        grid-template-columns: 1fr;
    }
}