/* ===== SCHEDULE PAGE ===== */

.schedule-main {
    margin-top: 80px;
    padding: 24px;
    max-width: 1600px;
    margin-left: auto;
    margin-right: auto;
}

/* Легенда */
.schedule-legend {
    display: flex;
    gap: 24px;
    justify-content: center;
    margin-bottom: 24px;
    padding: 16px 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
}

.legend-dot {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid transparent;
}

.legend-dot.work {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: #16a34a;
}

.legend-dot.partial {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #d97706;
}

.legend-dot.off {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

/* Навигация */
.schedule-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    margin-bottom: 24px;
}

.schedule-nav h2 {
    font-size: 24px;
    font-weight: 700;
    min-width: 200px;
    text-align: center;
}

/* Уведомление */
.schedule-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: var(--info-light);
    color: var(--info);
    border-radius: var(--border-radius);
    margin-bottom: 24px;
    font-weight: 500;
}

.schedule-notice.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.schedule-notice.success {
    background: var(--success-light);
    color: var(--success);
}

/* Секции */
.schedule-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
    overflow: hidden;
}

.schedule-section h3 {
    padding: 16px 20px;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--bg-tertiary);
}

.schedule-section h3 i {
    color: var(--primary);
}

/* Таблица */
.schedule-table-wrap {
    overflow-x: auto;
    padding: 0;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

.schedule-table th,
.schedule-table td {
    padding: 8px 4px;
    text-align: center;
    border-bottom: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
}

.schedule-table th {
    background: var(--bg-tertiary);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    position: sticky;
    top: 0;
    z-index: 10;
}

.schedule-table th:first-child,
.schedule-table td:first-child {
    position: sticky;
    left: 0;
    background: var(--bg-secondary);
    z-index: 5;
    min-width: 120px;
    text-align: left;
    padding-left: 16px;
    font-weight: 600;
    border-right: 2px solid var(--border-color);
}

.schedule-table th:first-child {
    background: var(--bg-tertiary);
    z-index: 15;
}

/* Дни недели в шапке */
.schedule-table th .day-num {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
}

.schedule-table th .day-name {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.schedule-table th.weekend {
    background: rgba(239, 68, 68, 0.1);
}

.schedule-table th.today {
    background: var(--primary-light);
}

.schedule-table th.today .day-num {
    color: var(--primary);
}

/* Ячейки статуса */
.schedule-cell {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px solid transparent;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.schedule-cell:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.schedule-cell.work {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    border-color: #16a34a;
    color: white;
}

.schedule-cell.partial {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    border-color: #d97706;
    color: white;
}

.schedule-cell.off {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-muted);
}

.schedule-cell.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.schedule-cell.disabled:hover {
    transform: none;
    box-shadow: none;
}

/* Имя пользователя */
.user-name {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

/* Кнопки действий */
.schedule-actions {
    text-align: center;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.schedule-actions .muted {
    margin-top: 12px;
    font-size: 13px;
}

/* Табы месяцев */
.month-tabs {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.month-tab {
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.month-tab:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.month-tab.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Responsive */
@media (max-width: 768px) {
    .schedule-main {
        padding: 16px;
        margin-top: 70px;
    }
    
    .schedule-legend {
        flex-wrap: wrap;
        gap: 12px;
    }
    
    .schedule-nav h2 {
        font-size: 18px;
        min-width: 150px;
    }
    
    .schedule-table th,
    .schedule-table td {
        padding: 4px 2px;
    }
    
    .schedule-cell {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

/* ===== EDITABLE NAME ===== */
.user-name.editable {
    cursor: pointer;
    padding: 4px 8px;
    margin: -4px -8px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.user-name.editable:hover {
    background: var(--primary-light);
}

.user-name.editable .edit-icon {
    opacity: 0;
    font-size: 12px;
    color: var(--primary);
    margin-left: 8px;
    transition: opacity 0.2s ease;
}

.user-name.editable:hover .edit-icon {
    opacity: 1;
}

.user-name-text {
    flex: 1;
}

/* Улучшаем ячейку с именем */
.schedule-table td:first-child {
    min-width: 140px;
}

/* ===== ADMIN PANEL ===== */
.admin-panel {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    border: 1px solid var(--primary);
    border-radius: var(--border-radius-lg);
    margin-bottom: 24px;
    overflow: hidden;
}

.admin-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: rgba(99, 102, 241, 0.1);
    border-bottom: 1px solid var(--primary);
}

.admin-panel-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.admin-panel-body {
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.admin-panel-body.collapsed {
    display: none;
}

.admin-section {
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
    padding: 16px;
    border: 1px solid var(--border-color);
}

.admin-section h4 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-section h4 i {
    color: var(--primary);
}

.admin-row {
    margin-top: 12px;
}

.date-range {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.date-range .form-group {
    margin: 0;
}

.date-range .form-group label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.date-range .form-control {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

.date-separator {
    color: var(--text-muted);
    padding-bottom: 8px;
}

/* Toggle Switch */
.toggle-switch {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.toggle-switch input {
    display: none;
}

.toggle-slider-sm {
    width: 44px;
    height: 24px;
    background: var(--bg-tertiary);
    border-radius: 12px;
    position: relative;
    transition: background 0.3s ease;
}

.toggle-slider-sm::before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: transform 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider-sm {
    background: var(--success);
}

.toggle-switch input:checked + .toggle-slider-sm::before {
    transform: translateX(20px);
}

/* Fill Status */
.fill-status-info {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 13px;
}

.fill-status-info.open {
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
}

.fill-status-info.closed {
    background: rgba(239, 68, 68, 0.1);
    color: var(--danger);
}

.fill-status-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.fill-status-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    font-size: 13px;
}

.fill-status-item .status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.fill-status-item .status-badge.filled {
    background: var(--success-light);
    color: var(--success);
}

.fill-status-item .status-badge.not-filled {
    background: var(--warning-light);
    color: var(--warning);
}

.fill-status-item .btn-reset {
    padding: 4px 8px;
    font-size: 11px;
    background: var(--danger-light);
    color: var(--danger);
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.fill-status-item .btn-reset:hover {
    background: var(--danger);
    color: white;
}

/* Section Header */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-tertiary);
}

.section-header h3 {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.section-header h3 i {
    color: var(--primary);
}

/* Delete button in row */
.btn-delete-user {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    background: var(--danger-light);
    color: var(--danger);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
    margin-left: 8px;
}

.user-name:hover .btn-delete-user {
    opacity: 1;
}

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

/* Modal styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background: var(--bg-secondary);
    border-radius: var(--border-radius-lg);
    width: 90%;
    max-width: 450px;
    box-shadow: var(--shadow-lg);
    animation: modalIn 0.3s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
}

.modal-close {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
}

/* Credentials box */
.credentials-box {
    background: var(--bg-tertiary);
    border-radius: var(--border-radius);
    padding: 16px;
}

.credential-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
}

.credential-row:first-of-type {
    margin-top: 8px;
}

.credential-row span {
    min-width: 60px;
    color: var(--text-muted);
}

.credential-row code {
    flex: 1;
    padding: 8px 12px;
    background: var(--bg-primary);
    border-radius: 6px;
    font-family: monospace;
    font-size: 14px;
}

.btn-copy {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    background: var(--primary-light);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 14px;
    transition: border-color 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Button variants */
.btn.danger {
    background: var(--danger);
    color: white;
}

.btn.danger:hover {
    background: #dc2626;
}

/* Responsive admin panel */
@media (max-width: 900px) {
    .admin-panel-body {
        grid-template-columns: 1fr;
    }
}

/* Добавь в конец schedule.css */

/* Link/Unlink badges */
.linked-badge, .unlinked-badge {
    font-size: 10px;
    margin-left: 4px;
    opacity: 0.6;
}

.linked-badge {
    color: var(--success);
}

.unlinked-badge {
    color: var(--text-muted);
}

.user-avatar.linked {
    background: linear-gradient(135deg, var(--success), #10b981);
}

.user-avatar.unlinked {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
}

.btn-link-user {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    opacity: 0;
    transition: all 0.2s;
}

.user-name.editable:hover .btn-link-user {
    opacity: 1;
}

.btn-link-user:hover {
    background: var(--primary-light);
}

/* Form hint */
.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}
