/* Sistema de Webhooks Rappi - Estilos Completos */

:root {
    --primary-color: #007bff;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --info-color: #17a2b8;
    --dark-color: #343a40;
    --light-color: #f8f9fa;
    --border-radius: 0.75rem;
    --shadow-light: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    --shadow-medium: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    --shadow-strong: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    --transition-fast: all 0.15s ease-in-out;
    --transition-normal: all 0.3s ease-in-out;
}

/* Fuentes y tipografía */
body {
    background-color: var(--light-color);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
}

/* Header principal */
.header-section {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--info-color) 100%);
    color: white;
    padding: 2.5rem 0;
    margin-bottom: 2rem;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    box-shadow: var(--shadow-medium);
    position: relative;
    overflow: hidden;
}

.header-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 20"><defs><pattern id="grain" width="100" height="20" patternUnits="userSpaceOnUse"><circle cx="10" cy="10" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="20" fill="url(%23grain)"/></svg>');
    opacity: 0.3;
}

.header-section .container {
    position: relative;
    z-index: 1;
}

/* Cards y componentes */
.card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    transition: var(--transition-normal);
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-strong);
    transform: translateY(-2px);
}

.card-header {
    background-color: #fff;
    border-bottom: 1px solid #e9ecef;
    border-radius: var(--border-radius) var(--border-radius) 0 0 !important;
    font-weight: 600;
    padding: 1.25rem 1.5rem;
}

.card-body {
    padding: 1.5rem;
}

/* Stats cards */
.stats-card {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-medium);
    transition: var(--transition-normal);
    height: 100%;
    position: relative;
    overflow: hidden;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(30px, -30px);
}

.stats-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-strong);
}

.stats-card .card-body {
    position: relative;
    z-index: 1;
}

.stats-icon {
    opacity: 0.8;
    transition: var(--transition-fast);
}

.stats-card:hover .stats-icon {
    opacity: 1;
    transform: scale(1.05);
}

/* Sección URL del webhook */
.webhook-info {
    background: linear-gradient(45deg, #f8f9fa, #e9ecef);
    border-left: 4px solid var(--primary-color);
}

.webhook-url-section {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    border: 2px dashed #dee2e6;
    transition: var(--transition-normal);
}

.webhook-url-section:hover {
    border-color: var(--primary-color);
    box-shadow: var(--shadow-light);
}

/* Indicadores de estado */
.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 0.5rem;
    animation: pulse 2s infinite;
}

.status-online { 
    background-color: var(--success-color);
    box-shadow: 0 0 0 4px rgba(40, 167, 69, 0.2);
}

.status-offline { 
    background-color: var(--danger-color);
    box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.2);
}

.status-warning { 
    background-color: var(--warning-color);
    box-shadow: 0 0 0 4px rgba(255, 193, 7, 0.2);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0.4);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(40, 167, 69, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(40, 167, 69, 0);
    }
}

/* Tablas */
.table {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-light);
}

.table thead th {
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
}

.table tbody tr {
    transition: var(--transition-fast);
}

.table tbody tr:hover {
    background-color: #f8f9fa;
    transform: scale(1.01);
}

.table-responsive {
    border-radius: var(--border-radius);
}

.cursor-pointer {
    cursor: pointer;
}

/* Badges y etiquetas */
.badge {
    font-size: 0.75rem;
    padding: 0.5em 0.75em;
    font-weight: 500;
    border-radius: 0.375rem;
}

.event-type-badge {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.order-total {
    font-weight: 700;
    color: var(--success-color);
    font-size: 1.1em;
}

/* Estados vacíos */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: #6c757d;
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
    color: var(--primary-color);
}

.empty-state h5 {
    color: #495057;
    margin-bottom: 0.5rem;
}

/* Botones */
.btn {
    border-radius: var(--border-radius);
    font-weight: 500;
    transition: var(--transition-fast);
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-medium);
}

.btn:active {
    transform: translateY(0);
}

/* Spinners y loading */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid transparent;
    border-top: 2px solid currentColor;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Modales */
.modal-content {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-strong);
}

.modal-header {
    background-color: #f8f9fa;
    border-bottom: 1px solid #dee2e6;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    background-color: #f8f9fa;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* Formularios */
.form-control {
    border-radius: var(--border-radius);
    border: 1px solid #ced4da;
    transition: var(--transition-fast);
}

.form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.form-select {
    border-radius: var(--border-radius);
}

.input-group .btn {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

.input-group .form-control {
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

/* Alerts */
.alert {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-light);
}

.alert-info {
    background-color: #d1ecf1;
    color: #0c5460;
}

.alert-warning {
    background-color: #fff3cd;
    color: #856404;
}

.alert-danger {
    background-color: #f8d7da;
    color: #721c24;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
}

/* Toast notifications */
.toast {
    border-radius: var(--border-radius);
    border: none;
    box-shadow: var(--shadow-strong);
}

.toast-header {
    border-radius: var(--border-radius) var(--border-radius) 0 0;
}

/* Código y texto monospace */
pre, code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
}

pre {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 1rem;
    overflow-x: auto;
}

.text-monospace {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace !important;
}

/* Responsive design */
@media (max-width: 768px) {
    .header-section {
        padding: 1.5rem 0;
        margin-bottom: 1.5rem;
    }
    
    .header-section h1 {
        font-size: 1.75rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        font-size: 0.9rem;
        padding: 0.5rem 1rem;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .modal-dialog {
        margin: 0.5rem;
    }
    
    .webhook-url-section {
        padding: 1rem;
    }
}

@media (max-width: 576px) {
    .container-fluid {
        padding-left: 0.5rem;
        padding-right: 0.5rem;
    }
    
    .header-section {
        border-radius: 0;
        margin-bottom: 1rem;
    }
    
    .card {
        border-radius: 0.5rem;
    }
    
    .stats-card .card-body {
        padding: 1rem;
    }
    
    .btn-group-sm .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* Animaciones adicionales */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.slide-in-right {
    animation: slideInRight 0.3s ease-out;
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        opacity: 1;
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.bounce-in {
    animation: bounceIn 0.6s ease-out;
}

/* Estados de carga */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

/* Scrollbar personalizado */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Utilidades adicionales */
.border-radius {
    border-radius: var(--border-radius) !important;
}

.shadow-custom {
    box-shadow: var(--shadow-medium) !important;
}

.text-gradient {
    background: linear-gradient(135deg, var(--primary-color), var(--info-color));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Efectos de hover específicos */
.hover-lift {
    transition: var(--transition-normal);
}

.hover-lift:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* Focus states mejorados */
.btn:focus,
.form-control:focus,
.form-select:focus {
    outline: none;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Mejorar accesibilidad */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Estados de conexión */
.connection-status {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius);
    font-size: 0.8rem;
    font-weight: 600;
    transition: var(--transition-fast);
}

.connection-status.online {
    background-color: var(--success-color);
    color: white;
}

.connection-status.offline {
    background-color: var(--danger-color);
    color: white;
    animation: pulse 1s infinite;
}

/* Mejoras para pantallas grandes */
@media (min-width: 1200px) {
    .container {
        max-width: 1400px;
    }
    
    .stats-card .card-body {
        padding: 2rem;
    }
    
    .card-body {
        padding: 2rem;
    }
}

/* Dark mode support (opcional) */
@media (prefers-color-scheme: dark) {
    :root {
        --light-color: #1a1a1a;
        --dark-color: #f8f9fa;
    }
    
    body {
        background-color: #121212;
        color: #e0e0e0;
    }
    
    .card {
        background-color: #1e1e1e;
        color: #e0e0e0;
    }
    
    .card-header {
        background-color: #2d2d2d;
        border-bottom-color: #3d3d3d;
    }
    
    .table {
        color: #e0e0e0;
    }
    
    .table thead th {
        background-color: #2d2d2d;
        border-bottom-color: #3d3d3d;
        color: #e0e0e0;
    }
    
    .table tbody tr:hover {
        background-color: #2d2d2d;
    }
    
    .form-control {
        background-color: #2d2d2d;
        border-color: #3d3d3d;
        color: #e0e0e0;
    }
    
    .form-control:focus {
        background-color: #2d2d2d;
        border-color: var(--primary-color);
        color: #e0e0e0;
    }
    
    .webhook-url-section {
        background-color: #2d2d2d;
        border-color: #3d3d3d;
    }
    
    .alert-info {
        background-color: #1e3a5f;
        color: #b8d4f0;
        border-color: #2d5a87;
    }
    
    pre {
        background-color: #2d2d2d;
        border-color: #3d3d3d;
        color: #e0e0e0;
    }
    
    .modal-content {
        background-color: #1e1e1e;
        color: #e0e0e0;
    }
    
    .modal-header,
    .modal-footer {
        background-color: #2d2d2d;
        border-color: #3d3d3d;
    }
}