/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #2563eb;
    --primary-dark: #1e40af;
    --secondary-color: #10b981;
    --text-color: #1f2937;
    --text-light: #6b7280;
    --bg-color: #ffffff;
    --bg-light: #f9fafb;
    --border-color: #e5e7eb;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --transition: all 0.3s ease;
}

html {
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--text-color);
    background-color: var(--bg-color);
    line-height: 1.6;
    font-size: 16px;
    overflow-x: hidden;
    width: 100%;
    max-width: 100%;
    position: relative;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    width: 100%;
    box-sizing: border-box;
}

/* Header Styles */
.header {
    background-color: var(--bg-color);
    box-shadow: var(--shadow);
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

.header-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 0;
}

.logo a {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.logo a:hover {
    color: var(--primary-dark);
}

/* Navigation Styles */
.nav {
    position: relative;
    z-index: 1002;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    gap: 4px;
}

.nav-toggle span {
    width: 25px;
    height: 3px;
    background-color: var(--text-color);
    transition: var(--transition);
    border-radius: 2px;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    padding: 0.5rem 0;
    position: relative;
}

.nav-menu a:hover,
.nav-menu a.active {
    color: var(--primary-color);
}

.nav-menu a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background-color: var(--primary-color);
}

/* Hero Section */
.hero-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white;
    padding: 4rem 0;
    text-align: center;
}

.hero-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    opacity: 0.9;
}

/* Page Header */
.page-header {
    background-color: var(--bg-light);
    padding: 3rem 0;
    text-align: center;
}

.page-title {
    font-size: 2rem;
    font-weight: 700;
    color: var(--text-color);
}

/* Content Section */
.content-section {
    padding: 3rem 0;
    position: relative;
    z-index: 1;
}

/* Prevent content overlap with mobile menu */
@media (max-width: 768px) {
    html.menu-open,
    body.menu-open {
        overflow: hidden;
        overflow-x: hidden;
        width: 100%;
        position: fixed;
    }
    
    .main-content {
        position: relative;
        z-index: 1;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
}

.content-wrapper {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.main-article {
    background-color: var(--bg-color);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.main-article h2 {
    font-size: 1.75rem;
    font-weight: 600;
    margin-top: 2rem;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.main-article h3 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-color);
}

.main-article p {
    margin-bottom: 1rem;
    color: var(--text-color);
    line-height: 1.8;
}

/* Article Images */
.article-image {
    margin: 2rem 0;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

.biography-image {
    width: 100%;
    height: auto;
    max-width: 100%;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    display: block;
    margin: 0 auto;
}

/* Ограничение размера изображений на десктопах */
@media (min-width: 769px) {
    .article-image {
        max-width: 85%;
        margin-left: auto;
        margin-right: auto;
    }
    
    .biography-image {
        max-width: 85%;
    }
}

@media (min-width: 1200px) {
    .article-image {
        max-width: 80%;
    }
    
    .biography-image {
        max-width: 80%;
    }
}

.article-image figcaption {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    color: var(--text-light);
    text-align: center;
    font-style: italic;
}

/* Sidebar */
.sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.sidebar-widget {
    background-color: var(--bg-light);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
}

.sidebar-widget h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
    color: var(--text-color);
}

.nav-links {
    list-style: none;
}

.nav-links li {
    margin-bottom: 0.5rem;
}

.nav-links a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
    display: block;
    padding: 0.5rem 0;
}

.nav-links a:hover {
    color: var(--primary-color);
    padding-left: 0.5rem;
}

/* Casino Table */
.casino-table-wrapper {
    overflow-x: auto;
    margin: 2rem 0;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.casino-table {
    width: 100%;
    border-collapse: collapse;
    background-color: var(--bg-color);
    min-width: 800px;
}

/* Mobile Card View for Casino Table - полностью адаптивная версия без горизонтальной прокрутки */
@media (max-width: 768px) {
    .casino-table-wrapper {
        overflow-x: visible;
        margin: 1.5rem 0;
        width: 100%;
        max-width: 100%;
    }
    
    .casino-table {
        min-width: 0;
        width: 100%;
        display: block;
    }
    
    .casino-table thead {
        display: none;
    }
    
    .casino-table tbody {
        display: block;
        width: 100%;
    }
    
    .casino-table tr {
        display: block;
        width: 100%;
        border: 4px solid var(--border-color);
        border-radius: 12px;
        margin-bottom: 1.5rem;
        padding: 1.25rem;
        background-color: var(--bg-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        box-sizing: border-box;
        transition: var(--transition);
    }
    
    .casino-table tr:hover {
        border-color: var(--primary-color);
        border-width: 4px;
        box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
        transform: translateY(-2px);
    }
    
    .casino-table td {
        display: block;
        width: 100%;
        border: none;
        position: relative;
        padding: 0.75rem 0;
        padding-left: 0;
        text-align: left;
        box-sizing: border-box;
    }
    
    .casino-table td:before {
        content: attr(data-label);
        display: block;
        font-weight: 600;
        color: var(--text-color);
        font-size: 0.875rem;
        margin-bottom: 0.25rem;
    }
    
    .casino-logo-cell {
        width: 100%;
        padding: 0 0 0.75rem 0 !important;
        text-align: left;
        border-bottom: 1px solid var(--border-color);
        margin-bottom: 0.75rem;
        padding-bottom: 1rem !important;
    }
    
    .casino-logo-cell:before {
        display: none;
    }
    
    .casino-logo {
        margin: 0;
        display: block;
        width: 120px;
        height: auto;
        max-height: 40px;
        object-fit: contain;
    }
    
    .casino-name {
        font-weight: 600;
        font-size: 1.125rem;
        margin-bottom: 0.5rem;
        padding-top: 0.5rem;
        text-align: left;
    }
    
    .casino-name:before {
        display: none;
    }
    
    .casino-bonus,
    .casino-deposit,
    .casino-rating {
        padding-left: 0;
        padding-top: 0.5rem;
    }
    
    .casino-action {
        padding: 1rem 0 0 0 !important;
        text-align: center;
        border-top: 1px solid var(--border-color);
        margin-top: 1rem;
        padding-top: 1.25rem !important;
    }
    
    .casino-action:before {
        display: none;
    }
    
    .casino-action .btn-play {
        width: 100%;
        max-width: 200px;
        display: inline-block;
        text-align: center;
    }
}

.casino-table thead {
    background-color: var(--primary-color);
    color: white;
}

.casino-table th {
    padding: 1rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.casino-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.casino-table tbody tr:hover {
    background-color: var(--bg-light);
}

.casino-logo-cell {
    width: 150px;
    min-width: 150px;
}

.casino-logo {
    width: 120px;
    height: 40px;
    object-fit: contain;
    border-radius: 6px;
    display: block;
    max-width: 100%;
}

.casino-logo-placeholder {
    width: 120px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 11px;
    text-align: center;
    padding: 5px;
}

.casino-name {
    font-weight: 600;
    color: var(--text-color);
}

.casino-bonus {
    color: var(--secondary-color);
    font-weight: 500;
}

.casino-deposit {
    color: var(--text-light);
}

.casino-rating {
    color: #fbbf24;
}

.star {
    font-size: 1.25rem;
}

.btn-play {
    display: inline-block;
    background-color: var(--primary-color);
    color: white;
    padding: 0.5rem 1.5rem;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    transition: var(--transition);
    border: none;
    cursor: pointer;
}

.btn-play:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* News Grid */
.news-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.news-card {
    background-color: var(--bg-color);
    border-radius: 8px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    word-wrap: break-word;
    overflow-wrap: break-word;
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.news-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-4px);
}

.news-card h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.news-card h2 a {
    color: var(--text-color);
    text-decoration: none;
    transition: var(--transition);
}

.news-card h2 a:hover {
    color: var(--primary-color);
}

.news-excerpt {
    color: var(--text-light);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.read-more {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
}

.read-more:hover {
    color: var(--primary-dark);
}

/* Footer */
.footer {
    background-color: var(--text-color);
    color: white;
    padding: 3rem 0 1.5rem;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-section h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1rem;
}

.footer-section p {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
}

.footer-section ul {
    list-style: none;
}

.footer-section ul li {
    margin-bottom: 0.5rem;
}

.footer-section a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.footer-section a:hover {
    color: white;
}

.telegram-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: var(--transition);
}

.telegram-link:hover {
    color: white;
}

.telegram-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
    flex-shrink: 0;
    transition: var(--transition);
}

.telegram-link:hover .telegram-icon {
    transform: scale(1.1);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.6);
}

/* Responsive Design */
@media (max-width: 968px) {
    .content-wrapper {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
    }

    .hero-title {
        font-size: 2rem;
    }

    .hero-subtitle {
        font-size: 1.125rem;
    }

    .page-title {
        font-size: 1.75rem;
    }
}

@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
    }

    .nav-menu {
        position: fixed;
        top: 70px;
        left: 0;
        right: 0;
        background-color: var(--bg-color);
        flex-direction: column;
        padding: 1rem;
        box-shadow: var(--shadow-lg);
        display: none;
        gap: 0;
        z-index: 999;
        max-height: calc(100vh - 70px);
        overflow-y: auto;
        width: 100%;
    }

    .nav-menu.active {
        display: flex;
    }

    .nav-menu li {
        width: 100%;
    }

    .nav-menu a {
        display: block;
        padding: 0.75rem 0;
        border-bottom: 1px solid var(--border-color);
    }

    .nav-toggle.active span:nth-child(1) {
        transform: rotate(45deg) translate(5px, 5px);
    }

    .nav-toggle.active span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -6px);
    }

    .hero-section {
        padding: 2rem 0;
    }

    .hero-title {
        font-size: 1.75rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .content-section {
        padding: 2rem 0;
    }

    .main-article h2 {
        font-size: 1.5rem;
    }

    .main-article h3 {
        font-size: 1.25rem;
    }

    .article-image {
        margin: 1.5rem 0;
    }

    .biography-image {
        border-radius: 6px;
    }

    .article-image figcaption {
        font-size: 0.8125rem;
        margin-top: 0.5rem;
    }

    .news-grid {
        grid-template-columns: 1fr;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
    }
    
    .news-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }

    /* Для планшетов оставляем табличный вид с горизонтальной прокруткой */
    .casino-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .casino-table {
        font-size: 0.875rem;
        min-width: 700px;
    }

    .casino-table th,
    .casino-table td {
        padding: 0.75rem 0.5rem;
    }

    .footer-content {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
    
    .container {
        padding: 0 15px;
        width: 100%;
        box-sizing: border-box;
    }

    .hero-title {
        font-size: 1.5rem;
        word-wrap: break-word;
    }

    .page-title {
        font-size: 1.5rem;
        word-wrap: break-word;
    }
    
    .main-article {
        padding: 1.5rem;
    }

    /* Мобильная версия таблицы уже настроена выше через @media (max-width: 768px) */
    .casino-table-wrapper {
        margin: 1rem 0;
        width: 100%;
        max-width: 100%;
    }
    
    .casino-table tr {
        padding: 1rem;
        width: 100%;
        box-sizing: border-box;
        border-width: 4px;
        border-radius: 10px;
    }
    
    .casino-logo {
        width: 100px;
        height: auto;
        max-height: 35px;
        max-width: 100%;
    }

    .btn-play {
        padding: 0.5rem 1.5rem;
        font-size: 0.875rem;
        width: 100%;
        max-width: 180px;
        box-sizing: border-box;
    }
    
    .casino-name {
        font-size: 1rem;
        word-wrap: break-word;
    }
    
    .news-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        overflow-x: hidden;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    
    .news-card {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Performance Optimizations */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Предотвращение горизонтальной прокрутки */
* {
    max-width: 100%;
}

/* Исключения для элементов, которым нужна полная ширина */
table,
iframe,
video,
canvas {
    max-width: 100%;
}

/* Адаптивные медиа-запросы для предотвращения переполнения */
@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
        width: 100%;
        position: relative;
    }
    
    .container {
        padding: 0 15px;
        width: 100%;
        box-sizing: border-box;
    }
    
    /* Убеждаемся, что все элементы помещаются */
    .main-content,
    .content-section,
    .content-wrapper,
    .main-article {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
        overflow-x: hidden;
    }
    
    /* Изображения не должны выходить за пределы */
    img,
    picture,
    source {
        max-width: 100%;
        height: auto;
    }
    
    /* Текст должен переноситься */
    h1, h2, h3, h4, h5, h6,
    p, span, a, li, td, th {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }
    
    /* Предотвращаем переполнение длинных слов */
    .main-article {
        word-wrap: break-word;
        overflow-wrap: break-word;
    }
}

/* Accessibility */
a:focus,
button:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print Styles */
@media print {
    .header,
    .footer,
    .sidebar,
    .nav-toggle {
        display: none;
    }

    .content-wrapper {
        grid-template-columns: 1fr;
    }
}
