/* Professional CRM System - Frontend Styles */
.professional-crm-dashboard {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: #000000;
    background: #ffffff;
    min-height: 100vh;
    padding: 0;
    max-width: 1400px;
    margin: 0 auto;
}

/* Уведомления */
.crm-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 5px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 15px;
    animation: slideInRight 0.3s ease;
    min-width: 300px;
    max-width: 500px;
}

.crm-notification.error {
    background: #dc3545;
}

.crm-notification.warning {
    background: #ffc107;
    color: #000;
}

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

.notification-content {
    flex: 1;
    font-weight: 500;
}

.notification-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.crm-notification.warning .notification-close {
    color: #000;
}

/* Заголовок */
.crm-header {
    background: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 0 30px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.crm-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 0;
    border-bottom: 1px solid #f5f5f5;
}

.crm-header-top h1 {
    font-size: 28px;
    font-weight: 700;
    color: #000000;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.crm-header-top h1 .dashicons {
    color: #0056b3;
    font-size: 32px;
    width: 32px;
    height: 32px;
}

.crm-user-info {
    display: flex;
    align-items: center;
    gap: 20px;
}

.crm-user-info .user-name {
    font-weight: 600;
    color: #000000;
    font-size: 16px;
}

.crm-user-info .crm-button.small {
    background: #0056b3;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}

.crm-user-info .crm-button.small:hover {
    background: #004494;
    color: white;
}

.button-icon {
    font-size: 14px;
}

/* Вкладки */
.crm-tabs {
    display: flex;
    gap: 1px;
    background: #f0f0f0;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
    margin-top: 20px;
}

.crm-tab {
    flex: 1;
    background: #ffffff;
    border: none;
    padding: 18px 24px;
    font-size: 16px;
    color: #666666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    border-bottom: 3px solid transparent;
}

.crm-tab:hover {
    background: #f8f8f8;
    color: #000000;
}

.crm-tab.active {
    background: #ffffff;
    color: #000000;
    font-weight: 600;
    border-bottom-color: #0056b3;
}

.tab-icon {
    font-size: 20px;
}

.tab-text {
    white-space: nowrap;
}

/* Контент */
.crm-content {
    padding: 40px 30px;
    background: #ffffff;
}

.crm-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.crm-tab-content.active {
    display: block;
}

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

/* Панель инструментов */
.crm-toolbar {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    flex-wrap: wrap;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.search-box {
    flex: 1;
    min-width: 350px;
    position: relative;
    display: flex;
}

.crm-search {
    flex: 1;
    padding: 12px 18px;
    border: 1px solid #ced4da;
    border-radius: 6px 0 0 6px;
    font-size: 15px;
    color: #000000;
    background: #ffffff;
    border-right: none;
}

.crm-search:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0,86,179,0.1);
}

.search-button {
    padding: 12px 24px;
    background: #0056b3;
    color: #ffffff;
    border: 1px solid #0056b3;
    border-radius: 0 6px 6px 0;
    cursor: pointer;
    font-size: 18px;
    transition: background 0.2s;
}

.search-button:hover {
    background: #004494;
}

.filter-box {
    min-width: 220px;
}

.crm-select {
    width: 100%;
    padding: 12px 18px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    color: #000000;
    background: #ffffff;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23333' 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 12px center;
    background-size: 16px;
    padding-right: 40px;
}

.crm-select:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0,86,179,0.1);
}

.refresh-button {
    padding: 12px 24px;
    background: #ffffff;
    color: #000000;
    border: 1px solid #ced4da;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.refresh-button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

/* Таблица */
.crm-table-container {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 30px;
}

.crm-data-table {
    width: 100%;
    border-collapse: collapse;
    color: #000000;
    font-size: 14px;
}

.crm-data-table th {
    background: #f8f9fa;
    padding: 16px 20px;
    text-align: left;
    font-weight: 600;
    color: #212529;
    border-bottom: 2px solid #dee2e6;
    white-space: nowrap;
    font-size: 14px;
}

.crm-data-table td {
    padding: 16px 20px;
    border-bottom: 1px solid #e9ecef;
    vertical-align: middle;
    font-size: 14px;
}

.crm-data-table tr:last-child td {
    border-bottom: none;
}

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

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

.loading-cell {
    text-align: center;
    padding: 60px 20px !important;
    color: #6c757d;
    font-size: 16px;
}

.crm-loader {
    display: inline-block;
    width: 24px;
    height: 24px;
    border: 3px solid #e9ecef;
    border-top: 3px solid #0056b3;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 12px;
    vertical-align: middle;
}

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

/* Кнопки действий */
.action-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.crm-button {
    padding: 8px 16px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    background: #ffffff;
    color: #000000;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.crm-button:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
    color: #000000;
}

.crm-button.primary {
    background: #0056b3;
    color: #ffffff;
    border-color: #0056b3;
}

.crm-button.primary:hover {
    background: #004494;
    border-color: #004494;
}

.crm-button.secondary {
    background: #ffffff;
    color: #0056b3;
    border-color: #0056b3;
}

.crm-button.secondary:hover {
    background: #f0f7ff;
}

.crm-button.danger {
    background: #dc3545;
    color: #ffffff;
    border-color: #dc3545;
}

.crm-button.danger:hover {
    background: #c82333;
    border-color: #bd2130;
}

.crm-button.large {
    padding: 14px 28px;
    font-size: 16px;
}

.crm-button.small {
    padding: 6px 12px;
    font-size: 13px;
    min-width: 40px;
    justify-content: center;
}

/* Формы */
.crm-form-container {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 10px;
    padding: 40px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    max-width: 900px;
    margin: 0 auto;
}

.form-title {
    font-size: 24px;
    font-weight: 700;
    color: #000000;
    margin: 0 0 40px 0;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 25px;
    margin-bottom: 40px;
}

.form-group {
    margin-bottom: 0;
}

.form-group.full-width {
    grid-column: 1 / -1;
}

.form-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: #000000;
    font-size: 15px;
}

.form-group label.required:after {
    content: " *";
    color: #dc3545;
}

.field-description {
    font-size: 13px;
    color: #6c757d;
    margin-top: 6px;
    font-style: italic;
}

.crm-input, .crm-textarea {
    width: 100%;
    padding: 12px 18px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 15px;
    color: #000000;
    background: #ffffff;
    transition: all 0.2s;
    box-sizing: border-box;
}

.crm-input:focus, .crm-textarea:focus {
    outline: none;
    border-color: #0056b3;
    box-shadow: 0 0 0 3px rgba(0,86,179,0.1);
}

.crm-textarea {
    min-height: 100px;
    resize: vertical;
    line-height: 1.5;
}

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

.form-actions {
    display: flex;
    gap: 15px;
    padding-top: 30px;
    border-top: 2px solid #f0f0f0;
    justify-content: flex-start;
}

/* Пагинация */
.crm-pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 30px;
    padding: 25px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #dee2e6;
}

.crm-pagination button {
    padding: 10px 18px;
    border: 1px solid #ced4da;
    background: #ffffff;
    color: #000000;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    transition: all 0.2s;
    min-width: 44px;
}

.crm-pagination button:hover:not(.active) {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.crm-pagination button.active {
    background: #0056b3;
    color: #ffffff;
    border-color: #0056b3;
}

/* Модальные окна */
.crm-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    animation: fadeIn 0.3s;
}

.crm-modal-dialog {
    background: #ffffff;
    margin: 5% auto;
    width: 90%;
    max-width: 700px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
    animation: slideIn 0.3s;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

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

.crm-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 25px 30px;
    border-bottom: 2px solid #f0f0f0;
    background: #ffffff;
    border-radius: 12px 12px 0 0;
}

.crm-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #000000;
}

.crm-modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6c757d;
    cursor: pointer;
    padding: 0;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s;
}

.crm-modal-close:hover {
    background: #f8f9fa;
    color: #000000;
}

.crm-modal-body {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

/* Стили для тегов */
.client-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin: 5px 0;
}

.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 12px;
    font-weight: 500;
    color: white;
    background: #0073aa;
    white-space: nowrap;
}

/* Логин */
.crm-login-required {
    text-align: center;
    padding: 80px 40px;
    background: #ffffff;
    border: 2px solid #f0f0f0;
    border-radius: 12px;
    color: #000000;
    max-width: 600px;
    margin: 40px auto;
}

.crm-login-required a {
    color: #0056b3;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 2px solid #0056b3;
    padding-bottom: 2px;
    transition: all 0.2s;
}

.crm-login-required a:hover {
    color: #004494;
    border-bottom-color: #004494;
}

/* Адаптивность */
@media (max-width: 768px) {
    .crm-header {
        padding: 0 20px;
    }
    
    .crm-header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
    
    .crm-tabs {
        flex-direction: column;
    }
    
    .crm-tab {
        width: 100%;
        justify-content: flex-start;
        padding: 16px 20px;
    }
    
    .crm-content {
        padding: 30px 20px;
    }
    
    .crm-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 15px;
    }
    
    .search-box,
    .filter-box {
        min-width: 100%;
    }
    
    .crm-form-container {
        padding: 25px 20px;
    }
    
    .form-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .form-row {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .crm-modal-dialog {
        width: 95%;
        margin: 10% auto;
    }
    
    .crm-pagination {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .action-buttons {
        flex-direction: column;
        gap: 8px;
    }
    
    .action-buttons .crm-button {
        width: 100%;
        justify-content: center;
    }
}
