* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    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;
}

header p {
    font-size: 1.2em;
    opacity: 0.9;
}

main {
    padding: 30px;
}

/* ФИО секция */
.fio-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 25px;
    border: 2px solid #e9ecef;
}

.form-group-inline {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.form-group-inline label {
    font-weight: 600;
    color: #2c3e50;
    min-width: 80px;
}

.form-group-inline input {
    flex: 1;
    min-width: 300px;
    padding: 12px 15px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.form-group-inline input:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Заголовок мероприятий */
.events-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #667eea;
}

.events-header h2 {
    color: #2c3e50;
    font-size: 1.8em;
}

/* Контейнер мероприятий */
#eventsContainer {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Карточка мероприятия */
.event-card {
    background: white;
    border: 2px solid #e9ecef;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
    transition: all 0.3s;
}

.event-card:hover {
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
    border-color: #667eea;
}

.event-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid #e9ecef;
}

.event-number {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 15px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 0.95em;
}

.btn-remove {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
}

.btn-remove:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(231, 76, 60, 0.3);
}

/* Сетка полей мероприятия */
.event-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
}

.grid-item {
    display: flex;
    flex-direction: column;
}

.grid-item.full-width {
    grid-column: 1 / -1;
}

.grid-item label {
    font-size: 0.85em;
    font-weight: 600;
    color: #555;
    margin-bottom: 6px;
}

.grid-item input[type="text"],
.grid-item select,
.grid-item textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.grid-item input:focus,
.grid-item select:focus,
.grid-item textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.grid-item textarea {
    resize: vertical;
    min-height: 40px;
}

.grid-item .error {
    font-size: 12px;
    color: #e74c3c;
    margin-top: 4px;
    min-height: 16px;
}

/* Секция даты */
.date-section {
    display: flex;
    flex-direction: column;
}

.date-options {
    display: flex;
    gap: 10px;
    align-items: center;
}

.date-options select {
    min-width: 150px;
}

.date-inputs-container {
    margin-top: 8px;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.range-pair {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.date-input {
    padding: 10px 12px;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    width: 100%;
}

.date-input[readonly] {
    background: #f8f9fa;
    cursor: not-allowed;
}

/* Кнопки действий */
.btn-primary,
.btn-success,
.btn-secondary {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.btn-success {
    background: linear-gradient(135deg, #27ae60 0%, #219653 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(39, 174, 96, 0.4);
}

.btn-success:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(39, 174, 96, 0.6);
}

.form-actions {
    margin-top: 30px;
    text-align: center;
}

/* Сообщения */
.messages {
    padding: 15px 20px;
    margin: 20px;
    border-radius: 8px;
}

.alert {
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 5px;
    font-weight: 500;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

footer {
    background: #2c3e50;
    color: white;
    text-align: center;
    padding: 20px;
    font-size: 14px;
}

/* Адаптивность */
@media (max-width: 1200px) {
    .event-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
}

@media (max-width: 992px) {
    .event-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
    
    .form-group-inline input {
        min-width: 250px;
    }
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        border-radius: 10px;
    }
    
    header h1 {
        font-size: 2em;
    }
    
    main {
        padding: 20px;
    }
    
    .event-grid {
        grid-template-columns: 1fr;
    }
    
    .date-options {
        flex-direction: column;
        align-items: stretch;
    }
    
    .date-inputs {
        flex-direction: column;
    }
    
    .events-header {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .form-group-inline {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-group-inline input {
        min-width: auto;
    }
}

@media (max-width: 480px) {
    .btn-primary,
    .btn-success {
        width: 100%;
        justify-content: center;
    }
    
    .event-header {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }
}

/* Таблица статистики */
#statsTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

#statsTable th,
#statsTable td {
    padding: 12px;
    border: 1px solid #ddd;
    text-align: left;
    vertical-align: top;
}

#statsTable th {
    background-color: #f8f9fa;
    font-weight: 600;
}

.no-data-cell {
    text-align: center;
    color: #7f8c8d;
    font-style: italic;
}

.grid-item input.error,
.grid-item select.error {
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.2) !important;
}