/* Стили для сворачиваемой боковой панели */
.sidebar {
    width: 250px;
    background: #2c3e50;
    color: white;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
}

.sidebar-collapsed .sidebar {
    width: 70px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-toggle {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.sidebar-toggle:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.sidebar-toggle-mobile {
    display: none;
    background: none;
    border: none;
    color: #333;
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    margin-right: 15px;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.2rem;
    font-weight: bold;
}

.logo i {
    color: #6632a8;
}

/* Стили для collapsed состояния */
.sidebar-collapsed .logo-text,
.sidebar-collapsed .nav-text,
.sidebar-collapsed .user-info,
.sidebar-collapsed .sidebar-toggle i {
    display: none;
}

.sidebar-collapsed .sidebar-toggle i {
    display: block;
    transform: rotate(180deg);
}

.sidebar-collapsed .user-profile {
    justify-content: center;
    padding: 15px 0;
}

.sidebar-collapsed .user-avatar {
    margin: 0;
}

.sidebar-collapsed .sidebar-nav li a {
    justify-content: center;
    padding: 12px 0;
}

.sidebar-collapsed .sidebar-nav li a i {
    margin: 0;
    font-size: 1.2rem;
}

.sidebar-collapsed .sidebar-footer a {
    justify-content: center;
}

.sidebar-collapsed .sidebar-footer i {
    margin: 0;
    font-size: 1.2rem;
}

/* Профиль пользователя */
.user-profile {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 40px;
    height: 40px;
    background-color: #6632a8;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.user-name {
    font-weight: 500;
}

.user-role {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Навигация */
.sidebar-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-nav li a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.sidebar-nav li.active a {
    background: #6632a8;
    color: white;
}

/* Футер сайдбара */
.sidebar-footer {
    margin-top: auto;
    padding: 20px;
}

.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
}

.logout-btn:hover {
    color: white;
}

/* Основной контент */
.main-content {
    flex: 1;
    background: #f5f7fa;
    transition: margin-left 0.3s ease;
}

.main-header {
    background: white;
    padding: 15px 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: #666;
}

.dark-icon {
    display: none;
}

.notifications {
    position: relative;
    cursor: pointer;
}

.badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.content-wrapper {
    padding: 25px;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .sidebar-toggle-mobile {
        display: block;
    }
    
    .sidebar {
        position: fixed;
        left: -250px;
        z-index: 1000;
        height: 100vh;
        box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    }
    
    .sidebar-collapsed .sidebar {
        left: 0;
        width: 250px;
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .sidebar::before {
        content: '';
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
        z-index: -1;
    }
    
    .sidebar-collapsed .sidebar::before {
        opacity: 1;
        visibility: visible;
    }
}

@media (min-width: 769px) {
    .sidebar-collapsed .main-content {
        margin-left: 70px;
    }
}

/* Подсказки для свернутого состояния */
.sidebar-collapsed .sidebar-nav li {
    position: relative;
}

.sidebar-collapsed .sidebar-nav li:hover::after {
    content: attr(title);
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    background: #2c3e50;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    white-space: nowrap;
    margin-left: 10px;
    font-size: 0.9rem;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

/* Модальное окно */
.modal {
    display: none;
    position: fixed;
    z-index: 1050;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: rgba(0,0,0,0.5);
}

.modal-dialog {
    max-width: 600px;
    margin: 30px auto;
}

.modal-content {
    background: white;
    border-radius: 8px;
    overflow: hidden;
}

.modal-header {
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    margin: 0;
    font-size: 1.2rem;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Кнопки */
.btn {
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: #6632a8;
    color: white;
}

.btn-primary:hover {
    background-color: #5a2c95;
}

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

.btn-secondary:hover {
    background-color: #545b62;
}

.btn-danger {
    background-color: #dc3545;
    color: white;
}

.btn-danger:hover {
    background-color: #c82333;
}

.btn-start {
    background-color: #6632a8;
    color: white;
}

.btn-stop {
    background-color: #e74c3c;
    color: white;
}

/* Формы */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

.form-control {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    box-sizing: border-box;
}

.form-control:focus {
    border-color: #6632a8;
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 50, 168, 0.1);
}

/* Контейнеры */
.app-container {
    display: flex;
    min-height: 100vh;
}

.auth-container {
    max-width: 500px;
    margin: 50px auto;
    padding: 30px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

.time-tracking-card,
.dashboard-card {
    background: white;
    border-radius: 8px;
    padding: 25px;
    margin-bottom: 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

/* Таблицы */
.table-responsive {
    overflow-x: auto;
}

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

.table th,
.table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.table th {
    background: #f9f9f9;
    font-weight: 500;
}

.table tr:hover {
    background: #f5f5f5;
}

.monthly-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.monthly-table th,
.monthly-table td {
    border: 1px solid #ddd;
    padding: 5px;
    text-align: center;
}

.monthly-table th {
    background-color: #f5f5f5;
    font-weight: 500;
}

.month-name {
    font-weight: bold;
    background-color: #f0f8ff;
    min-width: 120px;
}

.time-history-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.time-history-table th,
.time-history-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

.time-history-table th {
    background: #f9f9f9;
    font-weight: 500;
}

.time-history-table tr:hover {
    background: #f5f5f5;
}

/* Ячейки дней */
.day-cell {
    min-width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 3px;
    font-weight: 500;
    position: relative;
    border: 1px solid #ddd;
}

.day-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 0 5px rgba(0,0,0,0.2);
    z-index: 10;
}

.day-cell.inactive {
    background-color: #f9f9f9;
    cursor: default;
}

.day-cell.highlight-diff {
    border: 2px dashed #e63946;
    background-color: #ffe8e8 !important;
    cursor: help;
}

.day-cell.highlight-diff:hover {
    background-color: #ffd6d6 !important;
    border-color: #b71c1c;
}

.cell-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #333;
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
    pointer-events: none;
    z-index: 1000;
    margin-bottom: 5px;
}

.cell-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 5px;
    border-style: solid;
    border-color: #333 transparent transparent transparent;
}

.day-cell:hover .cell-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Статусы */
.status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.status-badge.working {
    background-color: #e3f5ff;
    color: #0066cc;
}

.status-badge.remote {
    background-color: #e6f7ee;
    color: #00a651;
}

.status-badge.vacation {
    background-color: #fff8e1;
    color: #ff8f00;
}

.status-badge.sick {
    background-color: #ffebee;
    color: #c62828;
}

.status-badge.not-working {
    background-color: #f0f0f0;
    color: #666;
}

.status-badge.completed {
    background-color: #e6f7ee;
    color: #00a651;
}

/* Карточки статистики */
.stats-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    display: flex;
    align-items: center;
    padding: 20px;
    border-radius: 12px;
    color: #666;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    transition: transform 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-icon {
    font-size: 2rem;
    margin-right: 15px;
    opacity: 0.9;
}

.stat-info h3 {
    margin: 0 0 5px 0;
    font-size: 0.9rem;
    opacity: 0.9;
}

.stat-info p {
    margin: 0;
    font-size: 1.5rem;
    font-weight: bold;
}

.stat-value {
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
    color: #6632a8;
}

.stat-meta {
    color: #666;
    margin-bottom: 10px;
}

.progress-bar {
    height: 8px;
    background: #f0f0f0;
    border-radius: 4px;
    overflow: hidden;
}

.progress {
    height: 100%;
    background: #6632a8;
}

/* Цвета карточек */
.bg-purple { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); }
.bg-green { background: linear-gradient(135deg, #4ecdc4 0%, #44a08d 100%); }
.bg-blue { background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); }
.bg-orange { background: linear-gradient(135deg, #ff9a9e 0%, #fad0c4 100%); }

/* Легенда */
.color-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    background: #f9f9f9;
    border-radius: 4px;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
}

.color-box {
    width: 20px;
    height: 20px;
    border-radius: 3px;
    border: 1px solid #ddd;
    flex-shrink: 0;
}

.legend-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Сотрудники */
.employee-info {
    display: flex;
    align-items: center;
}

.employee-avatar {
    width: 36px;
    height: 36px;
    background-color: #6632a8;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
    font-weight: bold;
}

.employee-name {
    font-weight: 500;
}

.actions {
    white-space: nowrap;
}

.btn-edit,
.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px;
}

.btn-edit {
    color: #6632a8;
}

.btn-delete {
    color: #e74c3c;
}

/* Сообщения */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

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

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

.error-message {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.success-message {
    color: #28a745;
    background-color: #d4edda;
    border: 1px solid #c3e6cb;
    padding: 10px;
    border-radius: 4px;
    margin-bottom: 20px;
    text-align: center;
}

/* Ссылки */
.auth-links,
.auth-link {
    margin-top: 20px;
    text-align: center;
}

.auth-links a,
.auth-link a {
    color: #6632a8;
    text-decoration: none;
}

.auth-links a:hover,
.auth-link a:hover {
    text-decoration: underline;
}

/* Темная тема */
.dark-theme {
    --bg-color: #1a1a1a;
    --text-color: #f0f0f0;
    --card-bg: #2d2d2d;
    --border-color: #444;
    --hover-color: #333;
}

.dark-theme body {
    background-color: var(--bg-color);
    color: var(--text-color);
}

.dark-theme .sidebar {
    background-color: #1e1e1e;
    border-right-color: var(--border-color);
}

.dark-theme .main-header {
    background-color: var(--card-bg);
    border-bottom-color: var(--border-color);
}

.dark-theme .card,
.dark-theme .modal-content,
.dark-theme .time-tracking-card,
.dark-theme .dashboard-card {
    background-color: var(--card-bg);
    color: var(--text-color);
}

.dark-theme .table th,
.dark-theme .table td {
    border-bottom-color: var(--border-color);
}

.dark-theme .table tr:hover {
    background-color: var(--hover-color);
}

.dark-theme .form-control {
    background-color: #333;
    border-color: var(--border-color);
    color: var(--text-color);
}

.dark-theme .sidebar-toggle-mobile {
    color: #f0f0f0;
}

.dark-theme .sidebar::before {
    background: rgba(0,0,0,0.7);
}

/* Чат (вынесено отдельно) */
#chat-toggle {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 300px;
    height: 44px;
    background: #007bff;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 15px;
    font-weight: 600;
    border-radius: 12px 12px 0 0;
    cursor: pointer;
    padding: 0 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 9999;
}

#chat-window {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 340px;
    height: 460px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 12px 12px 0 0;
    box-shadow: 0 4px 25px rgba(0,0,0,0.2);
    display: none;
    flex-direction: column;
    font-family: "Segoe UI", Tahoma, sans-serif;
    z-index: 10000;
    transition: all 0.3s ease;
}

#chat-window.open { display: flex; }

#chat-messages {
    flex: 1;
    padding: 10px;
    overflow-y: auto;
    background: #f5f5f7;
    display: flex;
    flex-direction: column;
}

.chat-message {
    max-width: 85%;
    margin: 5px 0;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

.chat-message.self {
    align-self: flex-end;
    background: #d7ebff;
    color: #000;
}

.chat-message.other {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #eee;
}

.msg-header {
    font-size: 11px;
    color: #777;
    margin-bottom: 3px;
    display: flex;
    justify-content: space-between;
}

.msg-reply {
    border-left: 3px solid #007bff;
    padding-left: 8px;
    margin-bottom: 5px;
    font-size: 12px;
    color: #555;
    background: rgba(0,0,0,0.03);
}

.msg-img img {
    max-width: 100%;
    border-radius: 8px;
    margin-top: 5px;
    cursor: pointer;
}

.chat-input-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #eee;
}

#chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 20px;
    outline: none;
}

#chat-send {
    background: #007bff;
    color: #fff;
    border: none;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-list {
    width: 200px;
    border-right: 1px solid #ddd;
    overflow-y: auto;
    background: #f8f9fa;
}

.chat-window.with-list {
    flex-direction: row;
}

.chat-list-item {
    padding: 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    transition: background 0.2s;
    position: relative;
}

.chat-list-item:hover {
    background: #e9ecef;
}

.chat-list-item.active {
    background: #e3f2fd;
    border-left: 3px solid #007bff;
}

.chat-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 4px;
}

.chat-last {
    font-size: 12px;
    color: #666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.chat-unread {
    position: absolute;
    right: 12px;
    top: 12px;
    background: #dc3545;
    color: white;
    font-size: 11px;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.msg-album {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    margin: 5px 0;
}

.album-thumb {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
    cursor: pointer;
}