:root {
            --primary-color: #4285f4;
            --primary-hover: #3367d6;
            --secondary-color: #ea4335;
            --success-color: #34a853;
            --warning-color: #fbbc05;
            --background-light: #ffffff;
            --background-dark: #1a1a1a;
            --surface-light: #f8f9fa;
            --surface-dark: #2d2d2d;
            --text-light: #202124;
            --text-dark: #e8eaed;
            --border-light: #dadce0;
            --border-dark: #3c4043;
            --shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);
            --shadow-hover: 0 3px 6px rgba(0,0,0,0.16), 0 3px 6px rgba(0,0,0,0.23);
        }

        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
            background: var(--background-light);
            color: var(--text-light);
            transition: all 0.3s ease;
        }

        body.dark-mode {
            background: var(--background-dark);
            color: var(--text-dark);
        }

        .container {
            display: flex;
            height: 100vh;
            overflow: hidden;
        }

        /* Header */
        .header {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 60px;
            background: var(--background-light);
            border-bottom: 1px solid var(--border-light);
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0 24px;
            z-index: 1000;
            transition: all 0.3s ease;
        }

        .dark-mode .header {
            background: var(--background-dark);
            border-bottom-color: var(--border-dark);
        }

        .logo {
            font-size: 1.5em;
            font-weight: 700;
            color: var(--primary-color);
            display: flex;
            align-items: center;
            gap: 8px;
        }

        .header-actions {
            display: flex;
            align-items: center;
            gap: 12px;
        }

        .theme-toggle {
            background: none;
            border: none;
            font-size: 1.2em;
            cursor: pointer;
            padding: 8px;
            border-radius: 8px;
            transition: all 0.2s ease;
        }

        .theme-toggle:hover {
            background: var(--surface-light);
        }

        .dark-mode .theme-toggle:hover {
            background: var(--surface-dark);
        }

        /* Sidebar */
        .sidebar {
            width: 320px;
            background: var(--surface-light);
            border-right: 1px solid var(--border-light);
            padding: 80px 16px 16px;
            padding-bottom: 80px;
            overflow-y: auto;
            transition: all 0.3s ease;
            scroll-behavior: smooth; /* Añadir esta línea */
        }

        .dark-mode .sidebar {
            background: var(--surface-dark);
            border-right-color: var(--border-dark);
        }

        .sidebar-title {
            font-size: 1.1em;
            font-weight: 600;
            margin-bottom: 16px;
            color: var(--text-light);
        }

        .dark-mode .sidebar-title {
            color: var(--text-dark);
        }

        /* Operator Cards */
        .operator-card {
            background: var(--background-light);
            border: 1px solid var(--border-light);
            border-radius: 8px;
            padding: 12px;
            margin-bottom: 8px;
            cursor: grab;
            transition: all 0.2s ease;
            position: relative;
            user-select: none;
        }

        .operator-card:hover {
            box-shadow: var(--shadow-hover);
            transform: translateY(-2px);
        }

        .operator-card.dragging {
            cursor: grabbing;
            opacity: 0.8;
            transform: rotate(3deg);
        }

        .dark-mode .operator-card {
            background: var(--background-dark);
            border-color: var(--border-dark);
        }

        .operator-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 4px;
        }

        .operator-name {
            font-weight: 600;
            color: var(--primary-color);
        }

        .info-btn {
            background: none;
            border: none;
            font-size: 14px;
            cursor: pointer;
            padding: 4px;
            border-radius: 50%;
            transition: all 0.2s ease;
        }

        .info-btn:hover {
            background: var(--surface-light);
        }
        
        .info-btn:active {
            transform: scale(0.95);
        }

        .dark-mode .info-btn:hover {
            background: var(--surface-dark);
        }

        .operator-description {
            font-size: 0.9em;
            color: #666;
            margin-bottom: 8px;
        }

        .dark-mode .operator-description {
            color: #aaa;
        }

        .operator-example {
            font-size: 0.8em;
            color: var(--success-color);
            background: rgba(52, 168, 83, 0.1);
            padding: 4px 8px;
            border-radius: 4px;
            font-family: monospace;
        }

        /* Main Content */
        .main-content {
            flex: 1;
            padding: 80px 24px 24px;
            padding-bottom: 100px;
            overflow-y: auto;
        }

        .workspace {
            max-width: 800px;
            margin: 0 auto;
        }

        .workspace-title {
            font-size: 1.8em;
            font-weight: 700;
            margin-bottom: 8px;
            color: var(--text-light);
        }

        .dark-mode .workspace-title {
            color: var(--text-dark);
        }

        .workspace-subtitle::after {
            content: " (Arrastra para añadir)";
            font-size: 0.85em;
            color: var(--primary-color);
            font-weight: 600;
        }

        .dark-mode .workspace-subtitle {
            color: #aaa;
        }

        /* Drop Zone */
        .drop-zone {
            background: var(--background-light);
            border: 2px dashed var(--border-light);
            border-radius: 12px;
            padding: 32px;
            margin-bottom: 24px;
            min-height: 200px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            transition: all 0.3s ease;
        }

        .drop-zone.drag-over {
            border-color: var(--primary-color);
            background: rgba(66, 133, 244, 0.05);
        }

        .dark-mode .drop-zone {
            background: var(--surface-dark);
            border-color: var(--border-dark);
        }

        .drop-zone-icon {
            font-size: 3em;
            margin-bottom: 16px;
            opacity: 0.3;
        }

        .drop-zone-text {
            text-align: center;
            color: #666;
            font-size: 1.1em;
        }

        .dark-mode .drop-zone-text {
            color: #aaa;
        }

        .query-builder {
            display: flex;
            flex-wrap: wrap;
            gap: 8px;
            min-height: 40px;
            align-items: center;
        }

        .query-token {
          background: var(--primary-color);
          color: white;
          padding: 8px 12px;
          border-radius: 20px;
          font-size: 0.9em;
          display: flex;
          align-items: center;
          gap: 8px;
          animation: slideIn 0.3s ease;
      }
      
      /* Añadir estos estilos nuevos */
      .token-input {
          background: rgba(255, 255, 255, 0.2);
          border: 1px solid rgba(255, 255, 255, 0.3);
          border-radius: 4px;
          padding: 2px 6px;
          color: white;
          font-size: 0.85em;
          min-width: 80px;
          outline: none;
      }
      
      .token-input::placeholder {
          color: rgba(255, 255, 255, 0.7);
      }
      
      .token-input:focus {
          background: rgba(255, 255, 255, 0.3);
          border-color: rgba(255, 255, 255, 0.5);
      }
      
      .query-token.multiple-type {
            background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
            box-shadow: 0 2px 4px rgba(0,0,0,0.1);
        }
        
        .or-indicator {
            background: var(--warning-color);
            color: var(--text-light);
            padding: 4px 8px;
            border-radius: 12px;
            font-size: 0.75em;
            font-weight: 600;
            margin: 0 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 30px;
            animation: slideIn 0.3s ease;
        }
        
        .dark-mode .or-indicator {
            color: var(--text-dark);
        }

        .token-remove {
            background: none;
            border: none;
            color: white;
            cursor: pointer;
            font-size: 16px;
            padding: 0;
            width: 16px;
            height: 16px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.2s ease;
        }

        .token-remove:hover {
            background: rgba(255, 255, 255, 0.2);
        }

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

        /* Query Input */
        .query-section {
            background: var(--surface-light);
            border-radius: 12px;
            padding: 20px;
            margin-bottom: 24px;
            border: 1px solid var(--border-light);
        }

        .dark-mode .query-section {
            background: var(--surface-dark);
            border-color: var(--border-dark);
        }

        .query-label {
            font-weight: 600;
            margin-bottom: 8px;
            color: var(--text-light);
        }

        .dark-mode .query-label {
            color: var(--text-dark);
        }

        .query-input {
            width: 100%;
            padding: 12px;
            border: 1px solid var(--border-light);
            border-radius: 8px;
            font-family: monospace;
            font-size: 14px;
            background: var(--background-light);
            color: var(--text-light);
            transition: all 0.2s ease;
        }

        .query-input:focus {
            outline: none;
            border-color: var(--primary-color);
            box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);
        }

        .dark-mode .query-input {
            background: var(--background-dark);
            border-color: var(--border-dark);
            color: var(--text-dark);
        }

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

        .btn {
            padding: 12px 24px;
            border: none;
            border-radius: 8px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            text-decoration: none;
        }

        .btn-primary {
            background: var(--primary-color);
            color: white;
        }

        .btn-primary:hover {
            background: var(--primary-hover);
            transform: translateY(-2px);
            box-shadow: var(--shadow-hover);
        }

        .btn-secondary {
            background: var(--surface-light);
            color: var(--text-light);
            border: 1px solid var(--border-light);
        }

        .btn-secondary:hover {
            background: var(--border-light);
            transform: translateY(-2px);
        }

        .dark-mode .btn-secondary {
            background: var(--surface-dark);
            color: var(--text-dark);
            border-color: var(--border-dark);
        }

        .dark-mode .btn-secondary:hover {
            background: var(--border-dark);
        }

        .btn-success {
            background: var(--success-color);
            color: white;
        }

        .btn-success:hover {
            background: #2d8a47;
            transform: translateY(-2px);
            box-shadow: var(--shadow-hover);
        }

        /* Toast Notifications */
        .toast {
            position: fixed;
            top: 80px;
            right: 24px;
            background: var(--success-color);
            color: white;
            padding: 12px 20px;
            border-radius: 8px;
            box-shadow: var(--shadow-hover);
            transform: translateX(100%);
            transition: all 0.3s ease;
            z-index: 1001;
        }

        .toast.show {
            transform: translateX(0);
        }

        /* Modal */
        .modal {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 1002;
            opacity: 0;
            visibility: hidden;
            transition: all 0.3s ease;
        }

        .modal.show {
            opacity: 1;
            visibility: visible;
        }

        .modal-content {
            background: var(--background-light);
            border-radius: 12px;
            padding: 24px;
            max-width: 500px;
            width: 90%;
            max-height: 80vh;
            overflow-y: auto;
            box-shadow: var(--shadow-hover);
            transform: scale(0.9);
            transition: all 0.3s ease;
        }

        .modal.show .modal-content {
            transform: scale(1);
        }

        .dark-mode .modal-content {
            background: var(--background-dark);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 16px;
        }

        .modal-title {
            font-size: 1.2em;
            font-weight: 600;
            color: var(--primary-color);
        }

        .modal-close {
            background: none;
            border: none;
            font-size: 24px;
            cursor: pointer;
            padding: 4px;
            border-radius: 50%;
            transition: all 0.2s ease;
        }

        .modal-close:hover {
            background: var(--surface-light);
        }

        .dark-mode .modal-close:hover {
            background: var(--surface-dark);
        }
        
        footer {
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            background: var(--surface-light);
            border-top: 1px solid var(--border-light);
            padding: 12px 24px;
            z-index: 1000;
            transition: all 0.3s ease;
            display: flex;
            justify-content: space-between;
            align-items: center;
            flex-wrap: wrap;
            gap: 16px;
            height: auto;
            min-height: 60px;
        }

        .dark-mode footer {
            background: var(--surface-dark);
            border-top-color: var(--border-dark);
        }

        .footer-links {
            display: flex;
            gap: 16px;
            align-items: center;
        }

        .footer-link {
            color: var(--primary-color);
            text-decoration: none;
            font-size: 0.9em;
            transition: all 0.2s ease;
            padding: 4px 8px;
            border-radius: 4px;
        }

        .footer-link:hover {
            background: rgba(66, 133, 244, 0.1);
        }

        .dark-mode .footer-link:hover {
            background: rgba(66, 133, 244, 0.2);
        }

        .footer-text {
            color: #666;
            font-size: 0.9em;
        }

        .dark-mode .footer-text {
            color: #aaa;
        }

        .footer-logo {
            display: flex;
            align-items: center;
            gap: 8px;
            font-weight: 600;
            color: var(--primary-color);
        }

        /* Responsive Design */
        @media (max-width: 768px) {
            .container {
                flex-direction: column;
            }
            
            .sidebar {
                width: 100%;
                height: 300px; /* Aumentado de 200px a 300px */
                border-right: none;
                border-bottom: 1px solid var(--border-light);
                padding: 80px 8px 16px; /* Reducido padding lateral de 16px a 8px */
                padding-bottom: 120px;
                height: calc(100vh - 140px);
                overflow-y: auto;
            }
            
            .main-content {
                padding: 16px;
                padding-bottom: 140px;
            }
            
            .drop-zone {
                padding: 20px;
                min-height: 150px;
            }
            
            .operator-card {
                touch-action: none;
                user-select: none;
                -webkit-user-select: none;
                -webkit-touch-callout: none;
                padding: 16px 12px; /* Aumentado padding vertical de 12px a 16px */
                margin-bottom: 12px; /* Aumentado de 8px a 12px */
                min-height: 80px; /* Añadido altura mínima */
            }
            
            .workspace-subtitle {
                font-size: 0.9em;
                text-align: center;
                padding: 0 8px;
            }
            
            .action-buttons {
                flex-direction: column;
                gap: 8px;
            }
            
            .btn {
                width: 100%;
                justify-content: center;
            }
        }

        /* Mejoras específicas para móviles */
        @media (max-width: 480px) {
            .sidebar {
                height: 320px; /* Aún más alto en pantallas muy pequeñas */
            }
            
            .operator-card {
                padding: 18px 12px; /* Más padding vertical en pantallas pequeñas */
                min-height: 85px;
            }
            
            .operator-header {
                margin-bottom: 8px; /* Más espacio entre elementos */
            }
            
            .operator-description {
                font-size: 0.85em; /* Texto ligeramente más pequeño pero legible */
                line-height: 1.4;
                margin-bottom: 10px;
            }
            
            .operator-example {
                font-size: 0.75em;
                padding: 6px 8px; /* Más padding */
            }
        }

        /* Drag and Drop Visual Feedback */
        .dragging * {
            pointer-events: none;
        }

        .drop-zone-empty {
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            height: 100%;
        }

        .drop-zone-filled {
            display: none;
        }

        .drop-zone.has-content .drop-zone-empty {
            display: none;
        }

        .drop-zone.has-content .drop-zone-filled {
            display: block;
        }

        /* Mobile-specific styles */
        .ghost-element {
            transition: none !important;
        }

        /* Touch feedback */
        .operator-card:active {
            transform: scale(0.98);
        }

        @media (max-width: 768px) {
            .drop-zone-text {
                font-size: 0.9em;
            }
            
            .drop-zone-text strong {
                display: block;
                margin-bottom: 4px;
            }
            
            .workspace-subtitle::after {
                content: " (Arrastra para añadir)";
                font-size: 0.85em;
                color: var(--primary-color);
                font-weight: 600;
            }
        }
        
        @media (max-width: 768px) {
            footer {
                flex-direction: column;
                text-align: center;
                padding: 12px;
            }
            
            .footer-links {
                justify-content: center;
            }
            
            .main-content {
                padding-bottom: 120px; /* Más espacio en móviles */
            }
        }
