/* CRM стили */
:root {
    --crm-primary: #2c3e50;
    --crm-secondary: #34495e;
    --crm-accent: #3498db;
    --crm-success: #27ae60;
    --crm-warning: #f39c12;
    --crm-danger: #e74c3c;
    --crm-light: #ecf0f1;
    --crm-dark: #2c3e50;
}

.crm-nav {
    position: fixed;
    left: 0;
    top: 0;
    width: 250px;
    height: 100vh;
    background: var(--crm-primary);
    color: var(--crm-light);
    box-shadow: 3px 0 15px rgba(0, 0, 0, 0.1);
    z-index: 1000;
}

.nav-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.nav-header h2 {
    color: var(--crm-light);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 1rem;
}

.username {
    font-size: 0.9rem;
    opacity: 0.8;
}

.logout-btn {
    color: var(--crm-light);
    font-size: 0.9rem;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    padding: 5px 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-menu {
    list-style: none;
    padding: 1rem 0;
}

.nav-menu li {
    margin-bottom: 0.5rem;
}

/* admin.css задаёт пунктам меню свои отступы и flex - в CRM они на ссылках */
.crm-nav .nav-menu li {
    padding: 0;
    display: block;
}

.crm-nav .nav-menu li:hover {
    background: none;
}

.nav-menu a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.nav-menu a:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--crm-light);
}

.nav-menu a.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--crm-light);
    border-left: 4px solid var(--crm-accent);
}

.crm-content {
    margin-left: 250px;
    padding: 2rem;
    background: #f8f9fa;
    min-height: 100vh;
}

/* Дашборд */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e9ecef;
}

.dashboard-header h1 {
    color: var(--crm-dark);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.current-date {
    color: var(--crm-secondary);
    font-size: 0.9rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.stat-icon {
    background: var(--crm-accent);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
}

.stat-content h3 {
    font-size: 2.5rem;
    color: var(--crm-dark);
    margin: 0;
    line-height: 1;
}

.stat-content p {
    color: var(--crm-secondary);
    margin: 0.5rem 0 0 0;
    font-size: 0.9rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

.dashboard-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.dashboard-card h2 {
    color: var(--crm-dark);
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.upcoming-bookings {
    grid-column: span 2;
}

/* Таблицы */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.data-table thead {
    background: #f8f9fa;
    border-bottom: 2px solid #e9ecef;
}

.data-table th {
    padding: 0.8rem 1rem;
    text-align: left;
    color: var(--crm-dark);
    font-weight: 600;
}

.data-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
}

.data-table tr:hover {
    background: #f8f9fa;
}

/* Статусы */
.status-badge {
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 600;
    display: inline-block;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

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

.status-completed {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

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

/* Кнопки действий */
.actions {
    white-space: nowrap;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 4px;
    margin: 0 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.edit {
    background: #3498db;
    color: white;
}

.confirm {
    background: #27ae60;
    color: white;
}

.complete {
    background: #17a2b8;
    color: white;
}

.cancel {
    background: #e74c3c;
    color: white;
}

.reminder {
    background: #f39c12;
    color: white;
}

.bookings {
    background: #9b59b6;
    color: white;
}

.sms {
    background: #2ecc71;
    color: white;
}

.action-btn:hover {
    opacity: 0.8;
    transform: scale(1.1);
}

/* Формы */
.section-card, .dashboard-card {
    overflow-x: auto;
}

.form-card, .section-card, .filter-card {
    background: white;
    border-radius: 10px;
    padding: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    color: var(--crm-dark);
    font-size: 1.8rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.page-actions {
    display: flex;
    gap: 0.5rem;
}

/* Уведомления */
.notification {
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    animation: slideDown 0.3s ease;
}

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

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

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

.notification-info {
    background: #d1ecf1;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* Быстрые действия */
.actions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
}

.quick-btn {
    background: var(--crm-light);
    border: 2px solid #e9ecef;
    border-radius: 8px;
    padding: 1rem;
    text-decoration: none;
    color: var(--crm-dark);
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.quick-btn:hover {
    background: var(--crm-accent);
    color: white;
    border-color: var(--crm-accent);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
}

/* Информационные блоки */
.info-list {
    display: grid;
    gap: 0.8rem;
}

.info-item {
    display: flex;
    justify-content: space-between;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid #f0f0f0;
}

.info-label {
    color: var(--crm-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.info-value {
    color: var(--crm-dark);
    font-weight: 600;
}

/* Поиск */
.search-box {
    background: white;
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.search-form {
    display: flex;
    gap: 0.5rem;
}

.search-form input {
    flex: 1;
    padding: 0.8rem 1rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
}

/* Фильтры */
.filter-form {
    margin-top: 1rem;
}

.filter-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--crm-dark);
    font-weight: 600;
    font-size: 0.9rem;
}

.filter-group input,
.filter-group select {
    width: 100%;
    padding: 0.5rem;
    border: 2px solid #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

.filter-actions {
    display: flex;
    gap: 0.5rem;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--crm-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #e0e0e0;
}

/* Демо-версия: кнопки в меню, вход, мелкие элементы */
button.action-btn {
    border: none;
    font: inherit;
}

.nav-action {
    width: 100%;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    padding: 0.8rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    text-align: left;
}

.nav-action:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--crm-light);
}

.nav-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.5rem 0;
}

.nav-toggle-crm {
    display: none;
    background: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    color: var(--crm-light);
    padding: 6px 10px;
    font-size: 1.1rem;
    cursor: pointer;
}

.no-data {
    color: var(--crm-secondary);
    padding: 1rem 0;
}

.small-link {
    display: inline-block;
    margin-top: 0.4rem;
    font-size: 0.85rem;
    color: var(--crm-accent);
}

.data-table a {
    color: var(--crm-accent);
}

.error {
    color: #842029;
    background: #f8d7da;
    padding: 10px;
    border-radius: 5px;
    margin-bottom: 1rem;
    text-align: center;
}

.login-back {
    text-align: center;
    margin-top: 1.5rem;
}

.login-back a {
    color: var(--primary-color);
}

[hidden] {
    display: none !important;
}

/* Мобильная адаптация */
@media (max-width: 1024px) {
    .crm-nav {
        width: 200px;
    }
    
    .crm-content {
        margin-left: 200px;
    }
    
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .upcoming-bookings {
        grid-column: span 1;
    }
}

@media (max-width: 768px) {
    .crm-nav {
        position: static;
        width: 100%;
        height: auto;
    }
    
    .nav-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    
    .nav-menu {
        display: none;
    }

    .nav-toggle-crm {
        display: block;
    }

    .crm-content {
        padding: 1rem;
    }

    .page-header,
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .page-actions,
    .search-form {
        flex-wrap: wrap;
    }
    
    .nav-menu.active {
        display: block;
    }
    
    .crm-content {
        margin-left: 0;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    
    .filter-row {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .data-table {
        display: block;
        overflow-x: auto;
    }
}

/* Анимации */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.5s ease;
}