/* Основные стили CRM */
.mad-crm-public-wrapper {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

/* Login Form */
.mad-crm-login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 80vh;
    background: #f8f9fa;
}

.mad-crm-login-box {
    background: white;
    border-radius: 12px;
    padding: 40px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 400px;
}

.mad-crm-login-header {
    text-align: center;
    margin-bottom: 30px;
}

.mad-crm-login-header h2 {
    color: #0072BB;
    margin-bottom: 10px;
}

.mad-crm-login-header p {
    color: #666;
    font-size: 14px;
}

.mad-crm-error {
    background: #f8d7da;
    color: #721c24;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 20px;
    text-align: center;
}

.mad-crm-login-form {
    margin-top: 20px;
}

.mad-crm-form-group {
    margin-bottom: 20px;
}

.mad-crm-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #333;
}

.mad-crm-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s;
}

.mad-crm-input:focus {
    border-color: #0072BB;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 114, 187, 0.1);
}

.mad-crm-login-btn {
    width: 100%;
    padding: 14px;
    background: #0072BB;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}

.mad-crm-login-btn:hover {
    background: #005a9c;
}

.mad-crm-login-note {
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
    font-size: 14px;
    color: #666;
}

.mad-crm-login-note p {
    margin: 5px 0;
}

/* Header */
.mad-crm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 20px;
}

.mad-crm-header-left h1 {
    color: #0072BB;
    margin: 0 0 5px 0;
}

.mad-crm-subtitle {
    color: #666;
    margin: 0;
    font-size: 14px;
}

.mad-crm-user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #666;
    font-size: 14px;
}

.mad-crm-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

/* Buttons */
.mad-crm-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.3s;
}

.mad-crm-btn-primary {
    background: #0072BB;
    color: white;
}

.mad-crm-btn-primary:hover {
    background: #005a9c;
    color: white;
}

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

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

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

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

.mad-crm-btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

/* Stats */
.mad-crm-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin: 20px 0;
}

.mad-crm-stat-card {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    transition: transform 0.3s, box-shadow 0.3s;
}

.mad-crm-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
}

.mad-crm-stat-icon {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #0072BB;
}

.mad-crm-stat-value {
    font-size: 28px;
    font-weight: bold;
    color: #333;
    line-height: 1;
}

.mad-crm-stat-label {
    color: #666;
    font-size: 14px;
    margin-top: 5px;
}

/* Filters */
.mad-crm-filters {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
}

.mad-crm-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    align-items: end;
}

.mad-crm-filter-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mad-crm-select {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
}

.mad-crm-select:focus {
    border-color: #0072BB;
    outline: none;
}

/* Table */
.mad-crm-table-container {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    margin: 20px 0;
}

.mad-crm-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.mad-crm-table th {
    background: #f8f9fa;
    font-weight: 600;
    color: #333;
    text-align: left;
    padding: 15px 12px;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
}

.mad-crm-table td {
    padding: 12px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

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

/* Table Cells */
.student-info-cell {
    display: flex;
    align-items: center;
    gap: 12px;
}

.student-avatar-mini img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
}

.student-details-mini {
    min-width: 0;
}

.student-details-mini strong {
    display: block;
    margin-bottom: 2px;
    color: #333;
}

.student-email-mini {
    font-size: 12px;
    color: #666;
    overflow: hidden;
    text-overflow: ellipsis;
}

.customer-id-mini {
    font-size: 11px;
    color: #888;
}

.ptin-badge, .company-badge {
    font-size: 12px;
    color: #555;
    margin-bottom: 4px;
}

/* Badges */
.level-badge, .status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    min-width: 80px;
}

.level-badge.level-базовый {
    background: #e3f2fd;
    color: #0d47a1;
}

.level-badge.level-профессионал {
    background: #e8f5e9;
    color: #1b5e20;
}

.status-badge.status-active {
    background: #d4edda;
    color: #155724;
}

.status-badge.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

/* CPE Display */
.cpe-display {
    text-align: center;
}

.cpe-value {
    font-size: 16px;
    font-weight: bold;
    color: #0072BB;
}

.cpe-available-display small {
    font-size: 12px;
    color: #666;
}

.cpe-earned-display {
    font-size: 11px;
    color: #28a745;
    margin-top: 2px;
}

/* Actions */
.actions-cell {
    white-space: nowrap;
}

.action-buttons-mini {
    display: flex;
    gap: 5px;
}

.action-btn {
    width: 32px;
    height: 32px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}

.action-btn:hover {
    background: #f8f9fa;
    border-color: #0072BB;
    color: #0072BB;
}

.dropdown-mini {
    position: relative;
    display: inline-block;
}

.dropdown-content-mini {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    min-width: 180px;
    z-index: 100;
    padding: 5px 0;
}

.dropdown-mini:hover .dropdown-content-mini {
    display: block;
}

.dropdown-item {
    display: block;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
}

.dropdown-item:hover {
    background: #f8f9fa;
    color: #0072BB;
}

.dropdown-item:last-child {
    border-bottom: none;
}

/* Modal */
.mad-crm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    overflow: auto;
    padding: 20px;
}

.mad-crm-modal-content {
    background: white;
    border-radius: 12px;
    max-width: 900px;
    margin: 40px auto;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

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

.mad-crm-modal-header h3 {
    margin: 0;
    color: #333;
}

.mad-crm-modal-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    line-height: 1;
    padding: 0;
    width: 30px;
    height: 30px;
}

.mad-crm-modal-close:hover {
    color: #333;
}

.mad-crm-modal-body {
    padding: 20px;
    overflow: auto;
    flex: 1;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 40px !important;
}

.no-results-content {
    max-width: 300px;
    margin: 0 auto;
}

.no-results-content .dashicons {
    font-size: 48px;
    color: #ccc;
    margin-bottom: 15px;
}

.no-results-content p {
    color: #666;
    margin-bottom: 15px;
}

/* Responsive */
@media (max-width: 1200px) {
    .mad-crm-table-container {
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .mad-crm-public-wrapper {
        padding: 10px;
    }
    
    .mad-crm-header {
        flex-direction: column;
        text-align: center;
    }
    
    .mad-crm-stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .mad-crm-filter-grid {
        grid-template-columns: 1fr;
    }
    
    .mad-crm-actions {
        justify-content: center;
    }
}