/**
 * ⚙️ Admin Module Styles
 * Business1 CRM Admin Panel
 */

.admin-module {
    padding: 1rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== HEADER ===== */
.admin-header {
    margin-bottom: 1.5rem;
}

.admin-header .page-title {
    font-size: 28px;
    color: #6366f1;
    margin-bottom: 0.5rem;
}

.admin-header .page-subtitle {
    font-size: 14px;
    color: #94a3b8;
    margin: 0;
}

/* ===== TABS ===== */
.admin-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid rgba(99, 102, 241, 0.2);
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    font-size: 14px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    font-family: inherit;
}

.tab-btn:hover {
    color: #6366f1;
    background: rgba(99, 102, 241, 0.05);
}

.tab-btn.active {
    color: #6366f1;
    border-bottom-color: #6366f1;
    font-weight: 600;
}

/* ===== TAB CONTENT ===== */
.tab-content {
    animation: fadeIn 0.3s ease-in;
}

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

/* ===== SECTION HEADER ===== */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 20px;
    color: #e2e8f0;
    margin: 0;
}

.section-header .help-text {
    font-size: 13px;
    color: #94a3b8;
    margin: 0.5rem 0 0 0;
}

/* ===== BUTTONS ===== */
.btn-primary {
    padding: 0.75rem 1.5rem;
    background: #6366f1;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
}

.btn-primary:hover {
    background: #4f46e5;
}

.btn-danger-small {
    padding: 6px 14px;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

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

.btn-action-small {
    padding: 6px 14px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s;
}

.btn-action-small:hover {
    background: #059669;
}

/* ===== TABLE ===== */
.admin-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.35);
    border-radius: 8px;
    overflow: hidden;
}

.admin-table thead th {
    background: rgba(99, 102, 241, 0.1);
    padding: 12px 14px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #cbd5e1;
    border-bottom: 1px solid rgba(99, 102, 241, 0.35);
}

.admin-table tbody tr {
    transition: background 0.2s;
}

.admin-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.05);
}

.admin-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(99, 102, 241, 0.15);
    font-size: 14px;
    color: #e2e8f0;
}

.admin-table tbody tr:last-child td {
    border-bottom: none;
}

.user-id {
    color: #94a3b8;
    font-size: 12px;
}

/* ===== ROLE BADGES ===== */
.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.role-badge.role-sales {
    background: rgba(234, 179, 8, 0.2);
    color: #fbbf24;
}

.role-badge.role-support {
    background: rgba(59, 130, 246, 0.2);
    color: #60a5fa;
}

.role-badge.role-admin {
    background: rgba(168, 85, 247, 0.2);
    color: #a855f7;
}

/* ===== ROLE SELECT ===== */
.role-select {
    padding: 6px 10px;
    background: #1e293b;
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #e2e8f0;
    border-radius: 4px;
    font-size: 13px;
    cursor: pointer;
}

.role-select:focus {
    outline: none;
    border-color: #6366f1;
}

/* ===== PERMISSION CHECKBOXES ===== */
.permission-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: #6366f1;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: #1e293b;
    padding: 2rem;
    border-radius: 12px;
    max-width: 550px;
    width: 90%;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5);
    border: 1px solid rgba(99, 102, 241, 0.3);
    animation: modalSlideIn 0.3s ease-out;
}

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

.modal-content h2 {
    margin-top: 0;
    color: #6366f1;
    font-size: 22px;
    margin-bottom: 1.5rem;
}

.close {
    float: right;
    font-size: 28px;
    cursor: pointer;
    color: #94a3b8;
    transition: color 0.2s;
    line-height: 1;
    margin-top: -10px;
}

.close:hover {
    color: #ef4444;
}

/* ===== FORM ===== */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #cbd5e1;
    font-size: 14px;
    font-weight: 500;
}

.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem;
    background: #0f172a;
    border: 1px solid rgba(99, 102, 241, 0.35);
    color: #e2e8f0;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
}

.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6366f1;
}

.form-group textarea {
    resize: vertical;
}

.form-group select {
    cursor: pointer;
}

#assign-form .btn-primary {
    width: 100%;
    margin-top: 1rem;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #94a3b8;
    background: rgba(99, 102, 241, 0.05);
    border: 1px dashed rgba(99, 102, 241, 0.3);
    border-radius: 8px;
}

.empty-state p {
    margin: 0;
    font-size: 15px;
}

/* ===== PERMISSIONS MATRIX ===== */
.permissions-matrix th {
    text-align: center;
    font-size: 12px;
    padding: 8px 4px;
}

.permissions-matrix tbody td {
    text-align: center;
    padding: 6px 4px;
}

.permissions-matrix tbody td:first-child {
    text-align: left;
    font-weight: 500;
}

.permissions-matrix .permission-checkbox {
    cursor: pointer;
    width: 18px;
    height: 18px;
}

.permissions-matrix thead tr:first-child th[colspan] {
    border-bottom: 2px solid rgba(99, 102, 241, 0.3);
    background: rgba(99, 102, 241, 0.1);
    font-weight: 600;
}

/* ===== USERS MANAGEMENT TABLE ===== */
.users-management-table {
    font-size: 13px;
}

.users-management-table th {
    font-size: 12px;
    padding: 10px 12px;
}

.users-management-table td {
    padding: 8px 12px;
}

.user-info-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.user-info-cell strong {
    font-size: 14px;
}

.user-info-cell .user-id {
    color: #64748b;
    font-size: 11px;
}

.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
}

.status-badge.active {
    background: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

.status-badge.inactive {
    background: rgba(239, 68, 68, 0.2);
    color: #ef4444;
}

.telegram-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 11px;
    background: rgba(99, 102, 241, 0.2);
    color: #818cf8;
}

.telegram-badge.no-link {
    background: rgba(100, 116, 139, 0.2);
    color: #64748b;
}

.stats-mini {
    display: flex;
    gap: 12px;
    font-size: 12px;
}

.stats-mini span {
    color: #94a3b8;
}

.activity-cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.activity-cell small {
    color: #64748b;
    font-size: 11px;
}

.user-inactive {
    opacity: 0.6;
}

.user-inactive td {
    background: rgba(239, 68, 68, 0.05);
}

.text-muted {
    color: #64748b;
    font-style: italic;
}

/* ===== PASSWORD MODAL ===== */
.modal-small {
    max-width: 500px;
}

.password-modal-info {
    background: rgba(99, 102, 241, 0.1);
    border-left: 3px solid #6366f1;
    padding: 12px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.password-modal-info strong {
    color: #6366f1;
}

.password-input-group {
    display: flex;
    gap: 8px;
}

.password-input-group input {
    flex: 1;
}

.btn-toggle-password {
    padding: 0 12px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.3);
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.2s;
}

.btn-toggle-password:hover {
    background: rgba(99, 102, 241, 0.2);
}

.password-suggestions {
    background: rgba(234, 179, 8, 0.1);
    border-left: 3px solid #eab308;
    padding: 12px;
    margin-top: 16px;
    border-radius: 4px;
}

.password-suggestions ul {
    margin: 8px 0 0 20px;
    padding: 0;
}

.password-suggestions li {
    margin: 4px 0;
    font-size: 12px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn-primary {
    flex: 1;
}

.modal-actions .btn-secondary {
    flex: 0 0 auto;
    padding: 0.75rem 1.5rem;
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-actions .btn-secondary:hover {
    background: rgba(100, 116, 139, 0.3);
    border-color: rgba(100, 116, 139, 0.5);
}

/* ===== ACTION BUTTONS GROUP ===== */
.action-buttons-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-action-small {
    padding: 6px 12px;
    font-size: 12px;
    white-space: nowrap;
}

.btn-secondary {
    background: rgba(100, 116, 139, 0.2);
    color: #94a3b8;
    border: 1px solid rgba(100, 116, 139, 0.3);
}

.btn-secondary:hover {
    background: rgba(100, 116, 139, 0.3);
    border-color: rgba(100, 116, 139, 0.5);
}

/* ===== CLIENT VISIBILITY CHECKBOX ===== */
.visibility-checkbox {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #6366f1;
    vertical-align: middle;
}

.visibility-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.visibility-checkbox:hover:not(:disabled) {
    transform: scale(1.1);
    transition: transform 0.2s ease;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .admin-module {
        padding: 0.75rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .admin-tabs {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .tab-btn {
        padding: 0.6rem 1rem;
        font-size: 13px;
    }
    
    .admin-table {
        font-size: 13px;
    }
    
    .admin-table thead th,
    .admin-table td {
        padding: 8px 10px;
    }
    
    .modal-content {
        padding: 1.5rem;
        width: 95%;
    }
}

