/* Основные переменные */
:root {
    --primary-color: #28a745;
    --primary-dark: #218838;
    --secondary-color: #6c757d;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --border-radius: 10px;
    --box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

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

body {
    background-color: #e8f5e9;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    line-height: 1.6;
    min-height: 100vh;
    padding: 15px;
}

/* Контейнер */
.container {
    max-width: 1400px;
    margin: 0 auto;
}

/* Заголовок */
h1 {
    text-align: center;
    color: #2c3e50;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-wrap: wrap;
}

h1 span {
    background: linear-gradient(135deg, var(--primary-color), #34a853);
    color: white;
    padding: 5px 15px;
    border-radius: 50px;
    font-size: 0.8em;
}

/* Основной макет */
.dashboard {
    display: grid;
    grid-template-columns: 350px 1fr;
    gap: 20px;
}

/* Боковая панель */
.sidebar {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    overflow: hidden;
    height: fit-content;
    position: sticky;
    top: 15px;
}

.sidebar-header {
    background: linear-gradient(135deg, var(--primary-color), #34a853);
    color: white;
    padding: 20px;
    font-size: 1.2rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-content {
    padding: 20px;
}

/* Форма добавления события */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #495057;
    font-weight: 500;
    font-size: 0.95rem;
}

.form-group label i {
    margin-right: 8px;
    color: var(--primary-color);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background-color: white;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.1);
}

select.form-control {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23495057' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 16px;
    padding-right: 45px;
}

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

.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    width: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #34a853);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), #2d9247);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.3);
}

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

.btn-success {
    background-color: var(--primary-color);
    color: white;
}

.btn-danger {
    background-color: var(--danger-color);
    color: white;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
}

/* Легенда */
.legend {
    margin-top: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
    padding: 8px;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

.legend-color {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    margin-right: 12px;
}

.legend-color.planned { background: linear-gradient(135deg, var(--primary-color), #34a853); }
.legend-color.done { background: linear-gradient(135deg, #007bff, #0056b3); }
.legend-color.missed { background: linear-gradient(135deg, var(--warning-color), #e0a800); }

.legend-text {
    flex: 1;
    font-size: 0.95rem;
    color: #495057;
}

.legend-badge {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 20px;
    font-size: 0.8rem;
    color: #495057;
}

/* Календарь */
.calendar-wrapper {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    padding: 20px;
    overflow-x: auto;
}

#calendar {
    min-width: 300px;
}

/* Кастомные стили для FullCalendar */
.fc {
    font-size: 0.9em;
}

.fc-toolbar-title {
    font-size: 1.2em !important;
    color: #2c3e50;
}

.fc-button {
    background-color: var(--primary-color) !important;
    border-color: var(--primary-dark) !important;
    text-transform: capitalize;
    padding: 6px 12px !important;
    font-size: 0.9em !important;
}

.fc-button:hover {
    background-color: var(--primary-dark) !important;
}

.fc-button-active {
    background-color: var(--primary-dark) !important;
}

.fc-day-today {
    background-color: rgba(40, 167, 69, 0.05) !important;
}

.fc-event {
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    border: none !important;
    padding: 3px 5px !important;
    font-size: 0.85em;
    margin: 2px 0;
    border-radius: 4px;
}

.fc-event:hover {
    transform: scale(1.02);
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 1000;
}

.fc-event-title {
    font-weight: 500;
    white-space: normal;
    word-break: break-word;
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 15px;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: 15px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    background: white;
    border-radius: 15px 15px 0 0;
}

.modal-header h5 {
    font-size: 1.2rem;
    color: #2c3e50;
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #6c757d;
    padding: 0 10px;
}

.modal-close:hover {
    color: #343a40;
}

.modal-body {
    padding: 20px;
}

.modal-body p {
    margin-bottom: 15px;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 10px;
}

.modal-body strong {
    min-width: 100px;
    color: #495057;
}

.modal-body span {
    flex: 1;
    color: #212529;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.modal-footer .btn {
    flex: 1;
    min-width: 120px;
}

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-badge.planned { background: #e8f5e9; color: #2e7d32; }
.status-badge.done { background: #e3f2fd; color: #1565c0; }
.status-badge.missed { background: #fff3e0; color: #ef6c00; }

/* Уведомления */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.alert-close {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: inherit;
    opacity: 0.5;
}

.alert-close:hover {
    opacity: 1;
}

/* Мобильная навигация */
.mobile-nav-toggle {
    display: none;
    background: linear-gradient(135deg, var(--primary-color), #34a853);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 15px;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.mobile-nav-toggle i {
    font-size: 1.2rem;
}

/* Адаптивность */
@media (max-width: 992px) {
    .dashboard {
        grid-template-columns: 300px 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }
    
    .dashboard {
        grid-template-columns: 1fr;
    }
    
    .sidebar {
        position: static;
        display: none;
    }
    
    .sidebar.active {
        display: block;
    }
    
    .mobile-nav-toggle {
        display: flex;
    }
    
    .calendar-wrapper {
        padding: 10px;
    }
    
    .fc-toolbar {
        flex-direction: column;
        gap: 10px;
    }
    
    .fc-toolbar .fc-left,
    .fc-toolbar .fc-center,
    .fc-toolbar .fc-right {
        float: none;
        text-align: center;
    }
    
    .fc-view-container {
        margin-top: 10px;
    }
    
    .modal-footer {
        flex-direction: column;
    }
    
    .modal-footer .btn {
        width: 100%;
    }
    
    .fc-event {
        font-size: 0.75em;
        padding: 2px 4px !important;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 1.3rem;
    }
    
    .sidebar-header {
        padding: 15px;
    }
    
    .sidebar-content {
        padding: 15px;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    .form-control {
        padding: 10px 12px;
    }
    
    .btn {
        padding: 10px 20px;
    }
    
    .legend-item {
        flex-wrap: wrap;
    }
    
    .modal-body p {
        flex-direction: column;
        gap: 5px;
    }
    
    .modal-body strong {
        min-width: auto;
    }
    
    .fc .fc-toolbar-title {
        font-size: 1.1em !important;
    }
    
    .fc-button {
        padding: 4px 8px !important;
        font-size: 0.8em !important;
    }
}

/* Утилиты */
.text-success { color: var(--primary-color); }
.text-danger { color: var(--danger-color); }
.text-warning { color: var(--warning-color); }
.text-center { text-align: center; }
.mt-2 { margin-top: 10px; }
.mb-2 { margin-bottom: 10px; }
.w-100 { width: 100%; }

/* Анимации загрузки */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Печать */
@media print {
    .sidebar,
    .mobile-nav-toggle,
    .fc-toolbar .fc-button-group,
    .fc-toolbar .fc-today-button {
        display: none !important;
    }
    
    .calendar-wrapper {
        box-shadow: none;
        padding: 0;
    }
    
    #calendar {
        width: 100%;
    }
}

/* Панель пользователя */
.user-panel {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 1000;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    background: white;
    padding: 8px 15px;
    border-radius: 50px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.user-info i {
    color: #28a745;
    font-size: 1.2rem;
}

.user-info span {
    color: #333;
    font-weight: 500;
}

.admin-badge {
    background: #ffc107;
    color: #333;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
}

.logout-btn, .login-btn {
    color: #666;
    text-decoration: none;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.logout-btn:hover, .login-btn:hover {
    background: #f8f9fa;
    color: #28a745;
}

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: white;
    padding: 8px 15px;
    border-radius: 50px;
    color: #333;
    font-weight: 500;
}

@media (max-width: 768px) {
    .user-panel {
        top: 10px;
        right: 10px;
    }
    
    .user-info span:not(.admin-badge) {
        display: none;
    }
}