/* 
 * SECMCA API Debug Panel
 * Sistema de debug flotante con popup modal
 */

/* Burbuja flotante */
.secmca-debug-bubble {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 999998;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    animation: pulse 2s infinite;
}

.secmca-debug-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.secmca-debug-bubble-icon {
    font-size: 24px;
    color: white;
}

.secmca-debug-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 10px;
    padding: 2px 6px;
    font-size: 11px;
    font-weight: bold;
    min-width: 20px;
    text-align: center;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3), 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

/* Modal Overlay */
.secmca-debug-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    z-index: 999999;
    display: none;
    animation: fadeIn 0.3s ease;
}

.secmca-debug-overlay.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Modal Panel */
.secmca-debug-modal {
    background: white;
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}

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

/* Header */
.secmca-debug-header {
    padding: 20px 24px;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px 12px 0 0;
}

.secmca-debug-title {
    font-size: 20px;
    font-weight: 600;
    color: white;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.secmca-debug-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 24px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.secmca-debug-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Content */
.secmca-debug-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

/* Steps Container */
.secmca-debug-steps {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Step Card */
.secmca-debug-step {
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.secmca-debug-step.success {
    border-color: #28a745;
}

.secmca-debug-step.error {
    border-color: #dc3545;
}

.secmca-debug-step.warning {
    border-color: #ffc107;
}

/* Step Header */
.secmca-debug-step-header {
    padding: 16px 20px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    transition: background 0.2s ease;
}

.secmca-debug-step-header:hover {
    background: #e9ecef;
}

.secmca-debug-step.success .secmca-debug-step-header {
    background: #d4edda;
}

.secmca-debug-step.error .secmca-debug-step-header {
    background: #f8d7da;
}

.secmca-debug-step.warning .secmca-debug-step-header {
    background: #fff3cd;
}

.secmca-debug-step-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    font-size: 16px;
}

.secmca-debug-step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.secmca-debug-step.success .secmca-debug-step-icon {
    background: #28a745;
    color: white;
}

.secmca-debug-step.error .secmca-debug-step-icon {
    background: #dc3545;
    color: white;
}

.secmca-debug-step.warning .secmca-debug-step-icon {
    background: #ffc107;
    color: white;
}

.secmca-debug-step-toggle {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.secmca-debug-step.collapsed .secmca-debug-step-toggle {
    transform: rotate(-90deg);
}

/* Step Body */
.secmca-debug-step-body {
    padding: 20px;
    border-top: 1px solid #e0e0e0;
    display: none;
}

.secmca-debug-step:not(.collapsed) .secmca-debug-step-body {
    display: block;
}

/* Info Blocks */
.secmca-debug-info-block {
    margin-bottom: 16px;
}

.secmca-debug-info-block:last-child {
    margin-bottom: 0;
}

.secmca-debug-info-label {
    font-weight: 600;
    font-size: 13px;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.secmca-debug-info-value {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
    word-break: break-all;
    line-height: 1.5;
}

.secmca-debug-info-value.code {
    background: #282c34;
    color: #e0e0e0 !important;
    overflow-x: auto;
    max-height: 400px;
    padding: 12px;
    border-radius: 6px;
}

.secmca-debug-info-value.code pre {
    margin: 0;
    white-space: pre-wrap;
    color: #e0e0e0 !important;
}

/* Fix adicional para asegurar legibilidad */
.secmca-debug-info-value.code *,
.secmca-debug-step-content pre *,
.secmca-debug-step-content code {
    color: #e0e0e0 !important;
}

.secmca-debug-info-value:not(.code) {
    color: #333 !important;
}

.secmca-debug-step-content {
    color: #333 !important;
}

/* Asegurar que todo el texto JSON sea legible */
.secmca-debug-info-value.code *,
.secmca-debug-info-value.code span,
.secmca-debug-info-value.code a {
    color: #e0e0e0 !important;
}

/* Status Badge */
.secmca-debug-status {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.secmca-debug-status.success {
    background: #28a745;
    color: white;
}

.secmca-debug-status.error {
    background: #dc3545;
    color: white;
}

.secmca-debug-status.warning {
    background: #ffc107;
    color: #000;
}

/* Timestamp */
.secmca-debug-timestamp {
    font-size: 12px;
    color: #6c757d;
    font-style: italic;
}

/* Empty State */
.secmca-debug-empty {
    text-align: center;
    padding: 60px 20px;
    color: #6c757d;
}

.secmca-debug-empty-icon {
    font-size: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
}

.secmca-debug-empty-text {
    font-size: 16px;
}

/* Copy Button */
.secmca-debug-copy-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
    margin-left: auto;
}

.secmca-debug-copy-btn:hover {
    background: #0056b3;
}

/* Scrollbar */
.secmca-debug-content::-webkit-scrollbar {
    width: 8px;
}

.secmca-debug-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.secmca-debug-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.secmca-debug-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 768px) {
    .secmca-debug-modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .secmca-debug-bubble {
        bottom: 15px;
        right: 15px;
        width: 50px;
        height: 50px;
    }
    
    .secmca-debug-bubble-icon {
        font-size: 20px;
    }
}
