/* Все существующие стили остаются без изменений */
#sw-calendar-container {
    max-width: 1200px;
    margin: 0 auto;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 5px 5px;
    background: linear-gradient(135deg, #d9be2d 0%, #8d824b 100%);
    border-radius: 10px 10px 0 0;
    margin: 0 12px -10px 12px;
    position: relative;
    z-index: 2;
}

.nav-btn {
    padding: 12px 24px;
    font-size: 24px;
    font-weight: bold;
    border: none;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    padding: 0 12px;
    margin-bottom: 10px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.weekday {
    text-align: center;
    font-weight: 600;
    color: #5b5b67;
    padding: 12px 8px;
    font-size: 14px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

#sw-calendar {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(7, fr);
    gap: 10px;
    align-items: start;
    justify-items: stretch;
    padding: 12px;
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 8px 30px rgba(16, 24, 40, 0.06);
}

.day {
    position: relative;
    background: linear-gradient(180deg, #ffffff, #f4f7ff);
    border: 1px solid #e6e9f2;
    border-radius: 10px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 120px;
    overflow: visible;
    opacity: 0;
    transform: translateY(20px);
    animation: fadeInUp 0.3s ease forwards;
    transition: all 0.3s ease;
    cursor: pointer;
}
.day.notCurrentMonth {
    opacity: 0.3;
    pointer-events: none;
    background: #f8f9fa;
    color: rgba(108, 117, 125, 0.53);
}
.day-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 5px;
    justify-content: space-between;
}

.weekday-indicator {
    display: none;
    font-size: 11px;
    font-weight: 600;
    color: #6b7280;
    padding: 2px 6px;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 4px;
}

.day-number {
    font-weight: bold;
}

.day.today {
    border-color: #4f46e5;
}

.day.notCurrentMonth {
    opacity: 0.1;
    pointer-events: none;
    background: #f8f9fa;
    color: rgba(108, 117, 125, 0.53);
}

.day-events {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.event-preview {
    font-size: 12px;
    padding: 4px 6px;
    margin: 1px 0;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
    z-index: 1;
}

.event-preview:hover {
    border-color: white;
    transform: translateX(5px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.event-title {
    font-weight: 600;
    margin-bottom: 2px;
}

.event-time {
    font-size: 11px;
    opacity: 0.9;
}

.events-more-btn {
    font-size: 11px;
    color: #6b7280;
    cursor: pointer;
    text-align: center;
    padding: 2px;
    margin-top: 4px;
    border: 1px dashed #d1d5db;
    border-radius: 4px;
    z-index: 1;
}

.events-more-btn:hover {
    background: #f3f4f6;
}

.events-dropdown {
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.events-dropdown.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

/* Модальное окно для событий */
.calendar-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.calendar-modal {

    background: white;
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    align-items: flex-start;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
    position: relative;
}

.close-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #6b7280;
    padding: 5px;
}

.close-btn:hover {
    color: #374151;
}

.modal-header-content {
    flex: 1;
    margin-right: 40px;
}

.modal-title {
    margin: 0 0 8px 0;
    font-size: 24px;
    color: #1f2937;
}

.modal-subtitle {
    margin: 0;
    color: #6b7280;
    font-size: 14px;
}

.modal-body {
    padding: 24px;
}

.detail-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.detail-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.detail-icon {
    color: #4f46e5;
    width: 20px;
    text-align: center;
    margin-top: 2px;
}

.detail-content {
    flex: 1;
}

.detail-label {
    margin: 0 0 4px 0;
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    font-weight: 600;
}

.detail-value {
    margin: 0;
    color: #1f2937;
    font-size: 14px;
}

.modal-image {
    margin-bottom: 20px;
    border-radius: 8px;
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.modal-footer {
    padding: 24px;
    border-top: 1px solid #e5e7eb;
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.btn-primary {
    background: #4f46e5;
    color: white;
}

.btn-primary:hover {
    background: #4338ca;
}

.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-secondary:hover {
    background: #4b5563;
}

.btn-success {
    background: #10b981;
    color: white;
}

.btn-success:hover {
    background: #059669;
}

.btn-external {
    background: #3b82f6;
    color: white;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-external:hover {
    background: #2563eb;
}

.btn-external::after {
    content: '↗';
    font-size: 12px;
}

/* Стили для модального окна с формой */
.form-modal {
    max-width: 600px;
}

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: #4f46e5;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-textarea {
    min-height: 100px;
    resize: vertical;
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-checkbox input {
    width: 16px;
    height: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.form-required {
    color: #ef4444;
}

.form-success-message {
    background: #d1fae5;
    color: #065f46;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: none;
}

.form-error-message {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    display: none;
}

.form-loading {
    display: none;
    text-align: center;
    padding: 20px;
}

.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #4f46e5;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
    margin: 0 auto 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes fadeInUp {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.day:hover {
    transform: translateY(-8px) scale(1.15);
    box-shadow: 0 15px 30px rgba(16, 24, 40, 0.2);
    border-color: #4f46e5;
    z-index: 10;
}

@media (min-width: 1025px) {
    #sw-calendar {
        grid-template-columns: repeat(7, 1fr);
        /* Убираем дни следующего месяца в последней неделе */
        grid-auto-rows: minmax(120px, auto);
    }

    /* Дни следующего месяца в последней неделе */
    .day.notCurrentMonth:nth-last-child(-n+7) {
        display: none;
    }

    /* Если в последней неделе все дни из следующего месяца - показываем 7 пустых ячеек */
    #sw-calendar:has(.day.notCurrentMonth:nth-last-child(-n+7):last-child) {
        display: grid;
        grid-template-columns: repeat(7, 1fr);
    }
}

/* Адаптивность */
@media (max-width: 1024px) {
    .weekdays {
        display: none;
    }
    .weekday-indicator {
        display: inline-block;
    }
    #sw-calendar {
        grid-template-columns: repeat(4, 1fr);
    }
    .day.notCurrentMonth {
        display: none !important;
    }

}

@media (max-width: 768px) {
    #sw-calendar {
        grid-template-columns: repeat(3, 1fr);
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .day.notCurrentMonth {
        display: none !important;
    }
}

@media (max-width: 480px) {
    #sw-calendar {
        grid-template-columns: 1fr;
    }
    .day.notCurrentMonth {
        display: none !important;
    }
    .day {
        min-height: auto;
        height: auto;
        padding: 15px;
    }
    .day-events {
        gap: 8px;
    }
    .day:hover {
        transform: none;
        z-index: auto;
    }

}

