* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
}

header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 30px;
    text-align: center;
}

header h1 {
    font-size: 2.5em;
    margin-bottom: 10px;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    header {
        padding: 20px 15px;
    }
    
    header h1 {
        font-size: 1.8em;
    }
}

@media (max-width: 480px) {
    header {
        padding: 15px 10px;
    }
    
    header h1 {
        font-size: 1.5em;
        line-height: 1.2;
    }
}

.subtitle {
    font-size: 1.2em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

@media (max-width: 768px) {
    main {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    main {
        padding: 15px;
    }
}

.section {
    margin-bottom: 40px;
}

.section h2 {
    color: #667eea;
    font-size: 1.8em;
    margin-bottom: 10px;
    border-bottom: 3px solid #667eea;
    padding-bottom: 10px;
    word-wrap: break-word;
}

.section h3 {
    color: #764ba2;
    font-size: 1.4em;
    margin-top: 30px;
    margin-bottom: 15px;
    word-wrap: break-word;
}

@media (max-width: 768px) {
    .section h2 {
        font-size: 1.5em;
    }
    
    .section h3 {
        font-size: 1.2em;
        margin-top: 20px;
    }
}

@media (max-width: 480px) {
    .section h2 {
        font-size: 1.3em;
        padding-bottom: 8px;
    }
    
    .section h3 {
        font-size: 1.1em;
        margin-top: 15px;
        margin-bottom: 10px;
    }
}

.description {
    color: #666;
    margin-bottom: 20px;
    font-style: italic;
    font-size: 0.95em;
    line-height: 1.5;
}

@media (max-width: 480px) {
    .description {
        font-size: 0.85em;
        margin-bottom: 15px;
    }
}

.table-container {
    overflow-x: auto;
    margin-top: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
    .table-container {
        margin-top: 15px;
        border-radius: 6px;
    }
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.data-table th {
    padding: 15px;
    text-align: left;
    font-weight: 600;
    font-size: 1em;
}

.data-table td {
    padding: 12px 15px;
    border-bottom: 1px solid #e0e0e0;
}

@media (max-width: 768px) {
    .data-table th {
        padding: 12px 10px;
        font-size: 0.9em;
    }
    
    .data-table td {
        padding: 10px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .data-table th {
        padding: 10px 8px;
        font-size: 0.85em;
    }
    
    .data-table td {
        padding: 8px;
        font-size: 0.85em;
    }
}

.data-table tbody tr:hover {
    background-color: #f5f5f5;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.loading {
    text-align: center;
    color: #999;
    font-style: italic;
    padding: 20px !important;
}

.error {
    color: #e74c3c;
    text-align: center;
    padding: 20px !important;
}

.count-badge {
    display: inline-block;
    background: #667eea;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9em;
}

.matrix-table {
    font-size: 0.95em;
    min-width: 100%;
}

.matrix-table th {
    white-space: nowrap;
    text-align: center;
    padding: 12px 8px;
    font-size: 0.9em;
}

.matrix-table td {
    text-align: center;
    padding: 10px 8px;
    white-space: nowrap;
}

.matrix-table td:first-child {
    text-align: left;
    font-weight: 600;
    background-color: #f8f9fa;
    position: sticky;
    left: 0;
    z-index: 10;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .matrix-table {
        font-size: 0.85em;
    }
    
    .matrix-table th {
        padding: 10px 6px;
        font-size: 0.85em;
    }
    
    .matrix-table td {
        padding: 8px 6px;
        font-size: 0.85em;
    }
}

@media (max-width: 480px) {
    .matrix-table {
        font-size: 0.75em;
    }
    
    .matrix-table th {
        padding: 8px 4px;
        font-size: 0.75em;
    }
    
    .matrix-table td {
        padding: 6px 4px;
        font-size: 0.75em;
    }
    
    .matrix-table td:first-child {
        padding-left: 6px;
        padding-right: 6px;
    }
}

.total-row {
    background-color: #e8f4f8 !important;
    font-weight: 600;
}

.total-row td {
    border-top: 2px solid #667eea;
}

.total-row:hover {
    background-color: #d0e8f0 !important;
}

footer {
    background: #f8f9fa;
    padding: 20px 30px;
    text-align: center;
    border-top: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#last-update {
    color: #666;
    font-size: 0.9em;
}

.refresh-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1em;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.refresh-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.refresh-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    footer {
        padding: 15px 20px;
        flex-direction: column;
        gap: 15px;
    }
    
    #last-update {
        font-size: 0.85em;
    }
    
    .refresh-btn {
        width: 100%;
        max-width: 300px;
        padding: 12px 20px;
    }
}

@media (max-width: 480px) {
    footer {
        padding: 15px;
        gap: 12px;
    }
    
    #last-update {
        font-size: 0.8em;
    }
    
    .refresh-btn {
        width: 100%;
        padding: 14px 20px;
        font-size: 0.95em;
    }
}

.guests-info-section {
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 25px;
    border-radius: 8px;
    margin-bottom: 30px;
}

.guests-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
}

.guests-count {
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 1.3em;
}

.guests-by-gender {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.gender-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.gender-label {
    color: #555;
    font-size: 0.9em;
    font-weight: 500;
}

.gender-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 1.3em;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    min-width: 60px;
    text-align: center;
}

.guests-label {
    color: #555;
    font-weight: 500;
}

.guests-value {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 25px;
    border-radius: 8px;
    font-size: 1.5em;
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

@media (max-width: 768px) {
    .guests-info-section {
        padding: 20px;
        margin-bottom: 25px;
    }
    
    .guests-info {
        gap: 15px;
    }
    
    .guests-count {
        font-size: 1.1em;
        gap: 12px;
    }
    
    .guests-value {
        padding: 8px 20px;
        font-size: 1.3em;
    }
    
    .guests-by-gender {
        gap: 20px;
    }
    
    .gender-value {
        padding: 6px 16px;
        font-size: 1.2em;
    }
}

@media (max-width: 480px) {
    .guests-info-section {
        padding: 15px;
        margin-bottom: 20px;
    }
    
    .guests-info {
        gap: 15px;
    }
    
    .guests-count {
        flex-direction: column;
        text-align: center;
        gap: 10px;
        font-size: 1em;
    }
    
    .guests-label {
        font-size: 0.9em;
    }
    
    .guests-value {
        padding: 10px 20px;
        font-size: 1.5em;
        width: 100%;
        max-width: 200px;
    }
    
    .guests-by-gender {
        flex-direction: column;
        gap: 15px;
        width: 100%;
    }
    
    .gender-item {
        width: 100%;
    }
    
    .gender-value {
        width: 100%;
        max-width: 150px;
        padding: 8px 16px;
        font-size: 1.2em;
    }
    
    .gender-label {
        font-size: 0.85em;
    }
}

.interval-selector {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.interval-selector > label:first-child {
    font-weight: 700;
    color: #333;
    font-size: 1.05em;
    margin-right: 5px;
    white-space: nowrap;
}

.interval-options {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
}

.interval-option {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px 20px;
    background: white;
    border-radius: 8px;
    border: 2px solid #d0d0d0;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    min-width: 100px;
    justify-content: center;
}

.interval-option:hover {
    border-color: #667eea;
    background: #f0f4ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.interval-option input[type="radio"] {
    cursor: pointer;
    margin: 0;
    width: 18px;
    height: 18px;
    accent-color: #667eea;
}

.interval-option input[type="radio"]:checked + span {
    color: #667eea;
    font-weight: 700;
}

.interval-option input[type="radio"]:checked ~ span,
.interval-option:has(input[type="radio"]:checked) span {
    color: #667eea;
    font-weight: 700;
}

.interval-option:has(input[type="radio"]:checked) {
    border-color: #667eea;
    background: linear-gradient(135deg, #f0f4ff 0%, #e0e8ff 100%);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
    transform: translateY(-2px);
}

.interval-option span {
    color: #555;
    font-size: 1em;
    user-select: none;
    font-weight: 500;
}

@media (max-width: 768px) {
    .interval-selector {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .interval-options {
        width: 100%;
        gap: 12px;
    }
    
    .interval-option {
        flex: 1;
        justify-content: center;
        min-width: 100px;
    }
}

@media (max-width: 480px) {
    .interval-selector {
        padding: 12px;
    }
    
    .interval-options {
        flex-direction: column;
        width: 100%;
    }
    
    .interval-option {
        width: 100%;
    }
}

.chart-container {
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    height: 400px;
    position: relative;
}

.chart-container canvas {
    max-height: 100%;
}

@media (max-width: 768px) {
    .chart-container {
        margin: 15px 0;
        padding: 15px;
        height: 300px;
    }
}

@media (max-width: 480px) {
    .chart-container {
        margin: 10px 0;
        padding: 10px;
        height: 250px;
        border-radius: 6px;
    }
}

/* Дополнительные улучшения для мобильных */
@media (max-width: 480px) {
    .section {
        margin-bottom: 25px;
    }
    
    .loading, .error {
        font-size: 0.9em;
        padding: 15px !important;
    }
}

/* Улучшение для планшетов */
@media (min-width: 481px) and (max-width: 1024px) {
    .container {
        max-width: 95%;
    }
    
    .matrix-table {
        font-size: 0.9em;
    }
}

/* Стили для кнопки экспорта в PDF */
.export-pdf-btn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.95em;
    font-weight: 600;
    transition: transform 0.2s, box-shadow 0.2s;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
    display: flex;
    align-items: center;
    gap: 8px;
}

.export-pdf-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.export-pdf-btn:active {
    transform: translateY(0);
}

@media (max-width: 768px) {
    .export-pdf-btn {
        padding: 8px 16px;
        font-size: 0.9em;
    }
}

@media (max-width: 480px) {
    .export-pdf-btn {
        padding: 10px 15px;
        font-size: 0.85em;
        width: 100%;
        max-width: 300px;
        justify-content: center;
    }
}

