/* ========================================
   FRONTEND DASHBOARD - ESTILOS MODERNOS CORREGIDOS
   MEJORAS:
   - Secciones del formulario visualmente separadas
   - Scroll mejorado en el modal
   - Campos de organizador ahora visibles
   ======================================== */

:root {
    --tw-primary: #2563eb;
    --tw-primary-dark: #1e40af;
    --tw-secondary: #64748b;
    --tw-success: #10b981;
    --tw-warning: #f59e0b;
    --tw-danger: #ef4444;
    --tw-gray-50: #f9fafb;
    --tw-gray-100: #f3f4f6;
    --tw-gray-200: #e5e7eb;
    --tw-gray-300: #d1d5db;
    --tw-gray-700: #374151;
    --tw-gray-800: #1f2937;
    --tw-gray-900: #111827;
    --tw-radius: 12px;
    --tw-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --tw-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --tw-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

/* ========================================
   CONTENEDOR PRINCIPAL
   ======================================== */

.twingital-user-events-dashboard {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* ========================================
   HEADER CON ESTADÍSTICAS
   ======================================== */

.dashboard-header {
    margin-bottom: 2rem;
}

.dashboard-header h2 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--tw-gray-900);
    margin: 0 0 1.5rem 0;
}

.dashboard-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--tw-radius);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: var(--tw-shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--tw-shadow-lg);
}

.stat-card:nth-child(1) {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.stat-card:nth-child(2) {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.stat-card:nth-child(3) {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.stat-card:nth-child(4) {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.stat-icon {
    font-size: 2.5rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.stat-info {
    flex: 1;
    color: white;
}

.stat-value {
    display: block;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    margin-bottom: 0.25rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.stat-label {
    display: block;
    font-size: 0.875rem;
    opacity: 0.9;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ========================================
   TOOLBAR
   ======================================== */

.dashboard-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1.25rem;
    background: white;
    border-radius: var(--tw-radius);
    box-shadow: var(--tw-shadow);
    flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.btn-primary {
    background: var(--tw-primary);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9375rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.btn-primary:hover {
    background: var(--tw-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(37, 99, 235, 0.2);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-primary .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.filter-select {
    padding: 0.625rem 1rem;
    border: 1px solid var(--tw-gray-300);
    border-radius: 8px;
    font-size: 0.9375rem;
    background: white;
    cursor: pointer;
    transition: all 0.2s;
    color: var(--tw-gray-700);
}

.filter-select:hover {
    border-color: var(--tw-primary);
}

.filter-select:focus {
    outline: none;
    border-color: var(--tw-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* ========================================
   LISTA DE EVENTOS
   ======================================== */

.events-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
}

.event-card {
    background: white;
    border-radius: var(--tw-radius);
    overflow: hidden;
    box-shadow: var(--tw-shadow);
    transition: all 0.3s;
    border: 1px solid var(--tw-gray-200);
}

.event-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--tw-shadow-lg);
    border-color: var(--tw-primary);
}

.event-card-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
    background: var(--tw-gray-100);
}

.event-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.event-card:hover .event-card-image img {
    transform: scale(1.05);
}

.event-card-content {
    padding: 1.5rem;
}

.event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.event-card-header h4 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--tw-gray-900);
    line-height: 1.3;
    flex: 1;
}

.event-status {
    padding: 0.375rem 0.75rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.status-published {
    background: #d1fae5;
    color: #065f46;
}

.status-draft {
    background: #fef3c7;
    color: #92400e;
}

.status-pending {
    background: #dbeafe;
    color: #1e40af;
}

.event-card-meta {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-bottom: 1.25rem;
}

.meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--tw-gray-700);
    font-size: 0.875rem;
}

.meta-item .dashicons {
    color: var(--tw-primary);
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.event-card-actions {
    display: flex;
    gap: 0.625rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tw-gray-200);
}

.btn-action {
    flex: 1;
    padding: 0.625rem 1rem;
    border: 1px solid var(--tw-gray-300);
    background: white;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    text-decoration: none;
    color: var(--tw-gray-700);
}

.btn-action:hover {
    background: var(--tw-gray-50);
    border-color: var(--tw-gray-400);
    transform: translateY(-1px);
}

.btn-action .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
}

.btn-edit:hover {
    background: #dbeafe;
    border-color: var(--tw-primary);
    color: var(--tw-primary);
}

.btn-delete:hover {
    background: #fee2e2;
    border-color: var(--tw-danger);
    color: var(--tw-danger);
}

/* ========================================
   NO EVENTS STATE
   ======================================== */

.no-events {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 2rem;
    background: white;
    border-radius: var(--tw-radius);
    box-shadow: var(--tw-shadow);
}

.no-events .dashicons {
    font-size: 64px;
    width: 64px;
    height: 64px;
    color: var(--tw-gray-300);
    margin-bottom: 1rem;
}

.no-events h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tw-gray-900);
    margin: 0 0 0.5rem 0;
}

.no-events p {
    color: var(--tw-gray-600);
    margin: 0 0 1.5rem 0;
    font-size: 1rem;
}

.btn-create-first {
    background: var(--tw-primary);
    color: white;
    border: none;
    padding: 1rem 2rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: var(--tw-shadow-md);
}

.btn-create-first:hover {
    background: var(--tw-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--tw-shadow-lg);
}

/* ========================================
   MODAL - MEJORADO
   ======================================== */

.twingital-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease-out;
}

.modal-container {
    position: relative;
    background: white;
    border-radius: 16px;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--tw-gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--tw-gray-900);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--tw-gray-500);
    cursor: pointer;
    padding: 0.5rem;
    line-height: 1;
    border-radius: 6px;
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: var(--tw-gray-100);
    color: var(--tw-gray-900);
}

.modal-body {
    padding: 2rem;
    overflow-y: auto;
    flex: 1;
    height: fit-content;
    /* IMPORTANTE: Scroll suave */
    scroll-behavior: smooth;
}

/* Custom scrollbar para el modal */
.modal-body::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track {
    background: var(--tw-gray-100);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: var(--tw-gray-400);
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: var(--tw-gray-500);
}

.modal-footer {
    padding: 1.5rem 2rem;
    border-top: 1px solid var(--tw-gray-200);
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    background: var(--tw-gray-50);
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
}

/* ========================================
   FORMULARIO - SECCIONES MEJORADAS
   ======================================== */

.form-section {
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 2px solid var(--tw-gray-200);
}

.form-section:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.form-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--tw-gray-900);
    margin: 0 0 1.5rem 0;
    padding-bottom: 0.75rem;
    border-bottom: 2px solid var(--tw-primary);
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.form-section-title .dashicons {
    color: var(--tw-primary);
    font-size: 24px;
    width: 24px;
    height: 24px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.form-row:last-child {
    margin-bottom: 0;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group.full {
    grid-column: 1 / -1;
}

.form-group label {
    font-weight: 600;
    color: var(--tw-gray-900);
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
}

.form-control {
    padding: 0.75rem 1rem;
    border: 1px solid var(--tw-gray-300);
    border-radius: 8px;
    font-size: 0.9375rem;
    transition: all 0.2s;
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--tw-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    resize: vertical;
    min-height: 120px;
}

.form-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-help {
    font-size: 0.8125rem;
    color: var(--tw-gray-600);
    margin-top: 0.375rem;
}

/* Mapa en el formulario */
.event-map-picker {
    height: 300px;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid var(--tw-gray-300);
    background: var(--tw-gray-100);
}

/* Address search wrapper */
.address-search-wrapper {
    display: flex;
    gap: 0.5rem;
}

.address-search-wrapper .form-control {
    flex: 1;
}

.btn-search {
    padding: 0.75rem 1rem;
    background: var(--tw-primary);
    color: white;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-search:hover {
    background: var(--tw-primary-dark);
}

.btn-search .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

/* Imagen upload */
.image-upload-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.image-preview {
    width: 100%;
    height: 200px;
    border: 2px dashed var(--tw-gray-300);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    background: var(--tw-gray-50);
}

.image-preview:hover {
    border-color: var(--tw-primary);
    background: var(--tw-gray-100);
}

.image-preview.has-image {
    border-style: solid;
    border-color: var(--tw-success);
}

.image-placeholder {
    text-align: center;
    color: var(--tw-gray-500);
}

.image-placeholder .dashicons {
    font-size: 48px;
    width: 48px;
    height: 48px;
    margin-bottom: 0.5rem;
}

.image-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

.image-actions {
    display: flex;
    gap: 0.75rem;
}

.btn-secondary {
    background: white;
    color: var(--tw-gray-700);
    border: 1px solid var(--tw-gray-300);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.9375rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-secondary:hover {
    background: var(--tw-gray-50);
    border-color: var(--tw-gray-400);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-primary .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========================================
   NOTIFICACIONES
   ======================================== */

.twingital-notice {
    padding: 1rem 1.5rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.notice-success {
    background: #d1fae5;
    color: #065f46;
    border-left: 4px solid var(--tw-success);
}

.notice-error {
    background: #fee2e2;
    color: #991b1b;
    border-left: 4px solid var(--tw-danger);
}

.notice-info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid var(--tw-primary);
}

/* ========================================
   LOADING OVERLAY
   ======================================== */

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99998;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 768px) {
    .twingital-user-events-dashboard {
        padding: 1rem;
    }
    
    .dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .stat-card {
        padding: 1rem;
    }
    
    .stat-value {
        font-size: 2rem;
    }
    
    .dashboard-toolbar {
        flex-direction: column;
        align-items: stretch;
    }
    
    .toolbar-left,
    .toolbar-right {
        width: 100%;
        flex-direction: column;
    }
    
    .events-list {
        grid-template-columns: 1fr;
    }
    
    .form-row {
        grid-template-columns: 1fr;
    }
    
    .modal-container {
        margin: 1rem;
        max-height: calc(100vh - 2rem);
    }
    
    .modal-body {
        padding: 1.5rem;
    }
    
    .form-section-title {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .dashboard-stats {
        grid-template-columns: 1fr;
    }
    
    .dashboard-header h2 {
        font-size: 1.5rem;
    }
    
    .event-card-actions {
        flex-direction: column;
    }
}

/* Login Notice */
.twingital-login-notice {
    text-align: center;
    padding: 60px 30px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--tw-radius);
    color: white;
}

.login-icon {
    font-size: 64px;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 12px rgba(0,0,0,0.2));
}

.twingital-login-notice h3 {
    font-size: 28px;
    margin: 0 0 15px 0;
    font-weight: 700;
}

.twingital-login-notice p {
    font-size: 16px;
    margin: 0 0 30px 0;
    opacity: 0.95;
}

.btn-login {
    display: inline-block;
    padding: 15px 40px;
    background: white;
    color: #667eea;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 700;
    font-size: 16px;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}