/* Admin Panel Styles */

/* Admin Tabs */
.admin-tabs {
    display: flex;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 30px;
    background: white;
    border-radius: 8px 8px 0 0;
    overflow: hidden;
}

.tab-btn {
    flex: 1;
    padding: 15px 20px;
    background: #f8f9fa;
    border: none;
    border-right: 1px solid #e9ecef;
    cursor: pointer;
    font-weight: 500;
    color: #6c757d;
    transition: all 0.3s ease;
    position: relative;
}

.tab-btn:last-child {
    border-right: none;
}

.tab-btn:hover {
    background: #e9ecef;
    color: #495057;
}

.tab-btn.active {
    background: #007bff;
    color: white;
}

.tab-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #007bff;
}

/* Integration Cards */
.integration-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    overflow: hidden;
}

.integration-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.integration-title {
    display: flex;
    align-items: center;
}

.integration-title h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #2c3e50;
}

.integration-title p {
    margin: 0;
    font-size: 14px;
    color: #6c757d;
}

.integration-status {
    display: flex;
    align-items: center;
}

.integration-content {
    padding: 25px;
}

.integration-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

.account-item {
    padding: 10px;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.account-item:hover {
    background: #f1f5f9;
    border-color: #3b82f6;
}

/* Chatwoot Panel Styles */
.chatwoot-panel-container {
    min-height: 600px;
}

.chatwoot-login-panel {
    padding: 2rem 1rem;
}

.chatwoot-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background: white;
    border-bottom: 2px solid #e5e7eb;
    border-radius: 8px 8px 0 0;
}

.chatwoot-panel-info h3 {
    margin: 0 0 0.25rem 0;
    font-size: 1.1rem;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chatwoot-panel-info h3 i {
    color: #1f93ff;
}

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

.chatwoot-panel-content {
    flex: 1;
    background: white;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    min-height: 600px;
}

.chatwoot-panel-content iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* Alert Styles */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.alert-warning {
    background: #fff3cd;
    color: #856404;
    border-left: 4px solid #ffc107;
}

.alert-info {
    background: #d1ecf1;
    color: #0c5460;
    border-left: 4px solid #17a2b8;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border-left: 4px solid #28a745;
}

.alert-error {
    background: #f8d7da;
    color: #721c24;
    border-left: 4px solid #dc3545;
}

/* Roles and Permissions Styles */
.roles-permissions-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
    margin-top: 2rem;
}

.roles-panel, .permissions-panel {
    background: white;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.panel-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e5e7eb;
}

.panel-header h4 {
    margin: 0;
    color: #1f2937;
    font-size: 1.1rem;
}

.roles-list-container, .permissions-list-container {
    max-height: 600px;
    overflow-y: auto;
}

.role-item {
    padding: 1rem;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
}

.role-item:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.role-item.active {
    border-color: #3b82f6;
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.role-info h5 {
    margin: 0 0 0.5rem 0;
    color: #1f2937;
    font-size: 1rem;
}

.role-info p {
    margin: 0 0 0.5rem 0;
    color: #6b7280;
    font-size: 0.875rem;
}

.role-info small {
    color: #9ca3af;
    font-size: 0.75rem;
}

.role-actions {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.permission-module {
    margin-bottom: 2rem;
    padding: 1rem;
    background: #f9fafb;
    border-radius: 6px;
    border: 1px solid #e5e7eb;
}

.permission-module-title {
    margin: 0 0 1rem 0;
    color: #1f2937;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.permission-module-title i {
    color: #3b82f6;
}

.permission-items {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.permission-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
    cursor: pointer;
    transition: all 0.2s ease;
}

.permission-item:hover {
    border-color: #3b82f6;
    background: #f8fafc;
}

.permission-item input[type="checkbox"] {
    margin-top: 0.25rem;
    cursor: pointer;
}

.permission-name {
    font-weight: 500;
    color: #1f2937;
    display: block;
    margin-bottom: 0.25rem;
}

.permission-description {
    color: #6b7280;
    font-size: 0.875rem;
    display: block;
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

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

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

/* Admin Tab Content */
.admin-tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

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

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

/* Admin Header */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding: 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-header h3 {
    margin: 0;
    color: #2c3e50;
    font-size: 20px;
}

/* Admin Filters */
.admin-filters {
    display: flex;
    gap: 15px;
    margin-bottom: 20px;
    padding: 15px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.admin-filters input,
.admin-filters select {
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
}

.admin-filters input {
    flex: 1;
    max-width: 300px;
}

/* Admin Table */
.admin-table {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    overflow: hidden;
}

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

.admin-table th {
    background: #f8f9fa;
    padding: 15px;
    text-align: left;
    font-weight: 600;
    color: #495057;
    border-bottom: 2px solid #e9ecef;
}

.admin-table td {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

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

/* Role Badges */
.role-badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.role-badge.super_admin {
    background: #dc3545;
    color: white;
}

.role-badge.admin {
    background: #fd7e14;
    color: white;
}

.role-badge.owner {
    background: #6f42c1;
    color: white;
}

.role-badge.manager {
    background: #20c997;
    color: white;
}

.role-badge.agent {
    background: #007bff;
    color: white;
}

.role-badge.user {
    background: #6c757d;
    color: white;
}

/* Status Indicators */
.status-indicator {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
}

.status-indicator.active {
    background: #28a745;
}

.status-indicator.inactive {
    background: #dc3545;
}

.status-indicator.pending {
    background: #ffc107;
}

/* Roles Grid */
.roles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.roles-list,
.permissions-list {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
}

.roles-list h4,
.permissions-list h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
}

.role-item,
.permission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.role-item:hover,
.permission-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.role-item.selected {
    background: #e3f2fd;
    border-color: #007bff;
}

.role-info,
.permission-info {
    flex: 1;
}

.role-name,
.permission-name {
    font-weight: 500;
    color: #2c3e50;
    margin-bottom: 2px;
}

.role-description,
.permission-description {
    font-size: 12px;
    color: #6c757d;
}

.role-level {
    background: #6c757d;
    color: white;
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    font-weight: 500;
}

/* Subscriptions Grid */
.subscriptions-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.plans-section,
.subscriptions-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
}

.plans-section h4,
.subscriptions-section h4 {
    margin: 0 0 15px 0;
    color: #2c3e50;
    font-size: 16px;
}

/* Plan Cards */
.plan-card {
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 15px;
    transition: all 0.3s ease;
    position: relative;
}

.plan-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transform: translateY(-2px);
}

.plan-card.featured {
    border-color: #007bff;
    background: linear-gradient(135deg, #f8f9ff 0%, #e3f2fd 100%);
}

.plan-card.featured::before {
    content: 'Recomendado';
    position: absolute;
    top: -1px;
    right: 20px;
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 0 0 8px 8px;
    font-size: 12px;
    font-weight: 500;
}

.plan-name {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 5px;
}

.plan-description {
    color: #6c757d;
    font-size: 14px;
    margin-bottom: 15px;
}

.plan-pricing {
    display: flex;
    align-items: baseline;
    margin-bottom: 15px;
}

.plan-price {
    font-size: 24px;
    font-weight: 700;
    color: #007bff;
}

.plan-period {
    color: #6c757d;
    margin-left: 5px;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
}

.plan-features li {
    padding: 5px 0;
    color: #495057;
    font-size: 14px;
}

.plan-features li::before {
    content: '✓';
    color: #28a745;
    font-weight: bold;
    margin-right: 8px;
}

.plan-limits {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 20px;
}

.plan-limit {
    text-align: center;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 6px;
}

.plan-limit-value {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.plan-limit-label {
    font-size: 12px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Settings Grid */
.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.settings-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    padding: 20px;
}

.settings-card h4 {
    margin: 0 0 20px 0;
    color: #2c3e50;
    font-size: 16px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    gap: 5px;
}

.action-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 4px;
}

.action-btn.primary {
    background: #007bff;
    color: white;
}

.action-btn.primary:hover {
    background: #0056b3;
}

.action-btn.success {
    background: #28a745;
    color: white;
}

.action-btn.success:hover {
    background: #1e7e34;
}

.action-btn.warning {
    background: #ffc107;
    color: #212529;
}

.action-btn.warning:hover {
    background: #e0a800;
}

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

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

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

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

/* Permission Checkboxes */
.permission-checkbox {
    margin-right: 8px;
}

.permission-group {
    margin-bottom: 20px;
}

.permission-group-title {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 10px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: 6px;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.5px;
}

/* Loading States */
.admin-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #6c757d;
}

.admin-loading i {
    margin-right: 10px;
    animation: spin 1s linear infinite;
}

/* Empty States */
.admin-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: #6c757d;
    text-align: center;
}

.admin-empty i {
    font-size: 48px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.admin-empty h3 {
    margin: 0 0 10px 0;
    font-size: 18px;
    color: #495057;
}

.admin-empty p {
    margin: 0;
    font-size: 14px;
}

/* Responsive Design */
@media (max-width: 768px) {
    .admin-tabs {
        flex-direction: column;
    }
    
    .tab-btn {
        border-right: none;
        border-bottom: 1px solid #e9ecef;
    }
    
    .tab-btn:last-child {
        border-bottom: none;
    }
    
    .roles-grid,
    .subscriptions-grid,
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .admin-filters {
        flex-direction: column;
    }
    
    .admin-filters input {
        max-width: none;
    }
    
    .plan-limits {
        grid-template-columns: 1fr;
    }
    
    .action-buttons {
        flex-direction: column;
    }
}

/* Modal Enhancements for Admin */
.admin-modal .modal-content {
    max-width: 800px;
}

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

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

/* Success/Error Messages */
.admin-message {
    padding: 12px 16px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-weight: 500;
}

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

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

.admin-message.warning {
    background: #fff3cd;
    color: #856404;
    border: 1px solid #ffeaa7;
}

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